uploading image file using php in ubuntu or linux not working

PHP script might be prevented form uploading file because of permissions : Ubuntu/Linux

Am having this php script that should upload image

save it as upload.html

<!DOCTYPE html><html>

<form method=”post” action=”upload.php” enctype=”multipart/form-data”>
Select File<input type=”file” name=”file”>

<input type=”submit” name=”btn” value=”UPLOAD”>


save as upload.php

echo “File Uploaded”;
echo “file can’t be uploaded”;

now when you will try to upload image image will not be uploaded as because of  file permission
so to solve
Fixing file permissions for the entire www directory: 
open terminal and either copy paste or type it
sudo chown -R www-data:www-data /var/www/

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat