I'm trying to get my php test upload script to work and was wondering what the command would be to allow files to be uploaded in ubuntu server in the var/www/image directory
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Change edit group to www-data
chown -R (owner):www-data (folder)
And folder permission to 775
What username will be uploading the files? Usually on Ubuntu the Apache web server username is www-data. You can check for sure by finding the web server process in a process list command and seeing which username under which it is running.
ps aux | grep apache
orps aux | grep httpd
should give you that answer.Then you will usually want to make that Apache username the owner of the directory and all files and directories within it:
Ordinarily, the above should be enough, but if for some reason the directory, files or subdirectories do not have write permission for the owner username, that's easily fixed by changing the permissions to add that write access, like this:
cd /var/www
sudo chmod 775 image
You'll be prompted to enter the admin password - do so, and hit [return].
For file like image you don't need execution permission :
If you have directories inside image and you want to apply permission :
This will recursively search your directory and chmod 755 all directories only.
Similarly, the following will chmod all files only (and ignore the directories):
File name with space case (thanks to Nicklas B)
Change edit group may solve most of the problems of permissions.
Changing do www-data and set permission to 775.