0
public function imgUploader()
 {
     $filename = $_FILES['file']['name'];
     $tmpName = $_FILES['file']['tmp_name'];
     $targetDir = "guestebuch/images";


     if ( !empty($filename) && move_uploaded_file($tmpName, $targetDir.$filename) )
     {
         echo "Successfully uploaded.";
         echo "<br>";
     }
     else
     {
         echo "Error.";
         echo "<br>";
     }
 }

When I run the code it works but there are no files / images in the directory.

Daidara11
  • 15
  • 6

1 Answers1

-1

Just change this line

if ( !empty($filename) && move_uploaded_file($tmpName, $targetDir.$filename))

to

if ( !empty($filename) && move_uploaded_file($tmpName, $targetDir.'/'.$filename) )
Badrinath
  • 501
  • 5
  • 14