Palak Taneja
Palak Taneja

Reputation: 2061

failed to open stream : Is a directory in

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);

Upvotes: 10

Views: 23107

Answers (2)

mayid
mayid

Reputation: 1775

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.

Upvotes: 5

Prasanth Bendra
Prasanth Bendra

Reputation: 32740

It seems like your name is null

$destination = "test/". $name;

echo you name and see what is coimg there.

Upvotes: 20

Related Questions