8
votes

I am getting the following warnings on trying on move an uploaded file from the temp folder to the desired one using php

Warning: move_uploaded_file(test/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/..../filename.php on line 69

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpKrCpQw' to 'test/' in /home/..../filename.php on line 69

following are line nos 67 and 69 that are giving the error :

$destination = "test/". $name;

$answer = move_uploaded_file($_FILES['user_file']['tmp_name'],$destination);
2
$destination is apparently 'test/'. $name obviously is empty. - deceze♦

2 Answers

18
votes

It seems like your name is null

$destination = "test/". $name;

echo you name and see what is coimg there.

4
votes

For me, it was the filesize.

So, check php.ini to see if the uploaded file exceeds upload_max_filesize and post_max_size.

Or maybe add a validation rule in Laravel or js.