I have been using to upload an image file from HTML5/JS and using PHP script to save it in localhost(/var/www/) but i cant save it. the function move_uploaded_file always returns false while there is exists an object in _FILES object. I am a newbie in php:
$target = "upload/";
if(!empty($_FILES))
{
if(move_uploaded_file($_FILES['image_file']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['image_file']['name']). " has been uploaded...";
}
else {
echo "Sorry, there was a problem uploading your file. {$error}";
}
}
else
{
echo "_files is empty";
}
Try
Because you need to specify the name of file, not only the directory.
See example from PHP documentation
try this