I'm trying to upload files using my Ubuntu Virtual Server.
The PHP function moving the uploaded files returns the following error:
"Warning: move_uploaded_file(files/Site Logo.png): failed to open stream: Permission denied in /var/www/test.php on line 5 Warning: move_uploaded_file(): Unable to move '/tmp/phpZB7Mxi' to 'files/Site Logo.png' in /var/www/test.php on line 5"
The 开发者_JS百科directory has permissions 0777
which I set through the SSH and it still doesn't upload. PHP.ini is configured to upload ON
and stuff but no luck. I'd guess its permissions problems but I have set it to pretty much RWX
for every user?
My code originally was too complex for a video system so I tried a basic code like below:
$file = $_FILES['video']['name'];
echo $file;
move_uploaded_file($_FILES['video']['tmp_name'],"files/".$file);
echo "Done";
This wouldn't work either. So I am guessing it's how the server is configured?
I was getting the same problem, it was permission problem. Just
sudo chmod 777 /var/www/work_pathname/the_upload_pathname/*
A few things to check:
- You did check the permissions on files/ using ls -l?
- Did you run chmod 777 /var/www without the -R flag?
Still sounds like a permissions error, something small you might have missed...
精彩评论