1
votes

CentOS 6
WP 3.5.1

I have a WP site wich was working Ok and suddenly doesn't allow to upload files:
- Media uploader: Unable to create directory http://subdomain.domain.tld/app/wp-content/uploads/2013/06. Is its parent directory writable by the server?
- Browser uploader: Error saving media attachment.

The 06 folder already exists and I've been uploading to it without problems. I've faced this usual problem after installing WP or sometimes when month change but never with an existing folder

I've tried assigning 777 permissions to wp-content, uploads, 2013, 01, 02, ..., 06, setting the owner:group to apache:apache but no way! I read the reason could be SELinux but
# getenforce
Disable

But the most weird thing is now I realized I have the same problem in my localhost!?
OS X 10.6.8
XAMPP 1.7.3

3
the owner group should surely be www-data, which is Apache2's process id.shennan

3 Answers

1
votes

In shell:

chown -R www-data:www-data wp-content/uploads
chmod -R w+g wp-content/uploads

Not familiar with CentOS flavour so I may have it all wrong.

EDIT:

With a bit of reading around I think I'll take a guess that this is a server issue, in-so-far-as the WordPress framework not getting on with PHP in certain OS environments. It seems some others have had problems creating new 'month' folders in certain server setups. WordPress is supposed to create new folders under the user/group www-data or apache (whichever the correct process alias for Linux), but this can sometimes fail.

Some more suggestions:

1) In WordPress Admin Panel -> Settings -> Media, check that the 'Store uploads in this folder' textfield is as you would expect it to be. Perhaps even try explicitly giving it the 'app/wp-content/uploads' pathname.

2) Check some of the old (successfully) uploaded files, and see who owns them. Some people have reported the owner as being 'nobody', which would obviously be a problem.

3) Slightly more of a hack is unticking the 'Organise my folders into month and year based folders'. Obviously this will stop WordPress creating new folders based on time...

Also, if you find the solution, remember to switch permissions back to 755. 777 could be a security hazard.

0
votes

Give full permission to wp-content/uploads

chmod -R 777 wp-content/uploads

if you are having cpanel server, do this also

chown -R account_username: wp-content

0
votes

Go the the WordPress -> Settings -> Media and make sure the upload path is the correct path - recommended is the default path.