If you get this error when you try to upload an image to your WordPress blog, there are two things you can do:
- Go to Settings > Miscellaneous in your WordPress admin area and make sure that ‘Store uploads in this folder’ is set to the default:
wp-content/uploads(notice there is no ‘/’ before wp-content/uploads). Try to upload again and see if it works. - If that didn’t work, open up a terminal and navigate to the wp-content directory. If wp-content does not contain sub-directory called ‘uploads’, create one and then change its permissions to wide open (
sudo chmod 777 uploads/). Try to upload the image again. If this works, navigate to thewp-content/uploads/directory and check the owner of the image you just uploaded (ls -l). It will probably be something weird you’ve never seen before (mine was ‘www-data’). Navigate up a directory and change the owner of theuploadsfolder to the one WordPress want to use:sudo chown www-data:www:data. Then revert the permissions back to something a little safer:sudo chmod 755 uploads/and you’re done.
One Comment
ok
thanks for all
One Trackback
[...] 如果新安装的wordpress上传文件或者安装插件/主题失败,可能是apache的用户对发布路径的权限问题。 但如果将wp-content目录的权限设为777则危险太大了,应该将发布路径的所有者改为apache的用户即可。 在上传一张图片后可知apache进程所属的用户www-data http://likesalmon.net/wordpress-error-unable-to-create-directory-is-its-parent-directory-writable-by... [...]