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);
PHP - Failed to open stream : No such file or directory. In PHP scripts, whether calling include (), require (), fopen (), or their derivatives such as include_once, require_once, or even, move_uploaded_file (), one often runs into an error or warning: Failed to open stream : No such file or directory.
PHP - Failed to open stream : No such file or directory 1. Check the file path for typos either check manually (by visually checking the path) or move whatever is called by... 2. Check that the file path is correct regarding relative vs absolute path considerations if it is starting by a forward... ...
If none of the above worked, then the issue is probably that some PHP settings forbid it to access that file. Three settings could be relevant : If this is set PHP won't be able to access any file outside of the specified directory (not even through a symbolic link). if this is turned on restrictions might apply.
That user owns the file and possibly the parent directory (especially the parent directory if you want to write files). In most shared hosting environments this won't be an issue, because your user should own all the files underneath your root.
It seems like your name is null
$destination = "test/". $name;
echo you name and see what is coimg there.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With