I have apache running on Ubuntu and I'm trying to write (copy an image) in the following folder: /var/www/html/images
I'm trying to write it from HTML/PHP
<?php
$uploaddir = '/var/www/html/images';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
And I get the following message:
The file is valid and was successfully uploaded.
Here is some more debugging info:
Array
(
[userfile] => Array
(
[name] => Twitter.png
[type] => image/png
[tmp_name] => /tmp/phpwNoxUG
[error] => 0
[size] => 4870
)
)
So I'm assuming the code is working; I think the issue is that I don't have permission to write in the folder /var/www/html/images
from PHP because I can manually drop a picture in there.
I checked the error.log
file and there is no error registered
Note:
I already tried all the combinations of adding slashes to the path: /var/www/html/images
, /var/www/html/images/
etc and that's not the issue.
samuel 9490 0.0 0.0 13692 2120 pts/1 R+ 13:24 0:00 grep --color=auto httpd