Upload file wordpress Upload file wordpress wordpress wordpress

Upload file wordpress


You need to set folder permissions for /uploads/ and possibly for /wp-content/ , too.

Typically, both folders should be 755. You may have to temporarily raise /uploads/ to 777 and upload an image (this will also force the server to change the folder permissions and user to the correct settings), but change it back to 755 right away.

It's easiest to set permissions with an FTP client. See Filezilla and FTP Clients « WordPress Codex.

And see Changing File Permissions « WordPress Codex for the correct Wordpress permission settings:

From the codex.wordpress: Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared hosts, files should never be owned by the webserver process itself (sometimes this is www, or apache, or nobody user).

Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress (which may be different than the server account). For example, you may have a user account that lets you FTP files back and forth to your server, but your server itself may run using a separate user, in a separate user group, such as dhapache or nobody. If WordPress is running as the FTP account, that account needs to have write access, i.e., be the owner of the files, or belong to a group that has write access. In the latter case, that would mean permissions are set more permissively than default (for example, 775 rather than 755 for folders, and 664 instead of 644).


ssh in and navigate to the wp-content folder and type in these 2 lines:

sudo chown -R www-data uploads/sudo chmod -R 755 uploads/

or you can use the static and full path:

sudo chown -R www-data /var/www/wp-content/uploads/sudo chmod -R 755 /var/www/wp-content/uploads/

Do not change it to permissions 777 because that is simply insecure


I had the same problems last week. After trying all proposed solutions with no success, it occurred to me that we had SElinux enabled on the server. In my case, and maybe for many other people, SElinux was responsible of the error message:

Unable to create directory wp-content/uploads/2013/04. Is its parent directory writable by the server?

My solution is based on the one proposed here: http://doc-ok.org/?tag=selinux which could be more suitable to other people's needs.

In my case, my wordpress directory resides in my home folder on the server, to which I have ssh access. Otherwise you will have to ask your administrator.

Anyway, this is my solution.

chgrp -R apache wordpress #change wordpress with your base directory for wp..#alternatively, chown the whole directory to apachechmod -R 774 wordpress/wp-content #if chown by apache, the permissions can be more restrictive

In my case not only the folder ownership / group ownership had to be changed to apache. Also the SElinux label of wp-content directory had to be changed to either httpd_sys_rw_content_t or httpd_sys_content_t:

chcon -Rv --type=httpd_sys_content_t wordpress/wp-content

This did the trick for me.

More information on SElinux can be found for example at:

wiki.centos.org/HowTos/SELinux

and

fedoraproject.org/wiki/SELinux