I have seen my phpinfo file,it has no tmp value set so I set it to /tmp
upload_tmp_dir = "/tmp"
But still it is not working. My server is in Amazon ec2.
I have tried putting the upload_tmp_dir as "/var/www" (with no trailing slash ) ,but that too didn't work. Do I need to set permissions to the tmp directory ?
print_r($_FILES);
is giving
enter code here
Array ( [upload_file] => Array ( [name] => ps.jpg [type] => image/jpeg [tmp_name] => /tmp/phpBcpdfP [error] => 0 [size] => 193728 ) )
and
is_uploaded_file($_FILES['upload_file']['tmp_name'])
is giving the result 1
It is probably a permission issue on the destination folder.
Do sudo chmod -R 777 /destination/folder
and try again. Then it should work. If you still can't upload your file, maybe the permission problem is on a parent directory.
After that, find which user (and its group) is the owner of your uploaded file.
Then set the permission back, and change the owner of your directory : sudo chown -R owner_user.group /destination/folder
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.