0

Want to rename the image file "email.jpg" instead of "image" What correction need

HTML

<input type="email" name="email">
<input type="email" name="email">
<input type="file" name="image">

PHP

$file = $_FILES['image']['name'];
$file_loc = $_FILES['image']['tmp_name'];
$folder="../images/"; 
$new_file_name = strtolower($file);
$final_file=str_replace(' ','-',$new_file_name);

$name=$_POST['name'];
$email=$_POST['email'];

if(move_uploaded_file($file_loc,$folder.$final_file))
    {
        $image=$final_file;
    }
Chilarai
  • 1,842
  • 2
  • 15
  • 33
psp
  • 13
  • 2
  • The second parameter to `move_uploaded_file()` is the name of the file it's moved to, so you need to work out what this value should contain. – Nigel Ren Jul 19 '20 at 06:24
  • try to change this if(move_uploaded_file($file_loc,$folder.'/email.jpg')){ ...} – The concise Jul 19 '20 at 06:29

0 Answers0