Fix : WordPress has failed to upload. Unable to create directory.

By on December 13th, 2016

In this tutorial, we can learn how to fix error – “filename.jpg” has failed to upload. Unable to create directory wp-content/uploads/yyy/mm. Is its parent directory writable by the server?

WordPress is a free and open-source content management system (CMS) based on PHP and MySQL. You can use WordPress to create a beautiful website, blog, or app.


The uploaded file could not be moved to wp-content/uploads

This common error often occurs when you migrate your website from one hosting to another. This error is displayed when you try to upload files to your website from WordPress admin dashboard. This error also has some side effects such as you are not able to add/update plugins. WordPress will present you with FTP credentials screen, when you try to add a new plugin to the website. You have to add new plugins manually until this error is fixed.



In most cases this error occurs with the migrated websites. The websites which was already running without any issues will show this error soon after migration. When you upload files to the website, WordPress passes a request to web server(apache) to fetch the requested file from your hard drive and uploads the file to a temporary memory of the server. This file is then stored to the WordPress media library inside location wp-content/uploads/. The account that fetches the file from your hard drive is apache user account, which is ‘nobody’ by default. You will get the error message ‘The upload file could not be moved to wp-content/uploads/’, if apache user account has no permission or rights to the wp-content/uploads/ folder.


How to fix it?

Find out apache service account

You must be logged in your server as root user to perform the steps. Once logged in as root execute this command.

# ps aux | grep httpd

This should return the output like the following.

root      5597  0.0  0.1  70904  6552 ?        Ss   Nov18   2:03 /usr/local/apache/bin/httpd -k start -DSSL

nobody    8715  0.0  0.0  69728  2516 ?        S    17:11   0:00 /usr/local/apache/bin/httpd -k start -DSSL

nobody    8717  0.0  0.0  70904  2608 ?        S    17:11   0:00 /usr/local/apache/bin/httpd -k start -DSSL

nobody    8718  0.1  0.4 1332864 17180 ?       Sl   17:11   0:06 /usr/local/apache/bin/httpd -k start -DSSL

nobody    8719  0.1  0.4 1333004 17012 ?       Sl   17:11   0:07 /usr/local/apache/bin/httpd -k start -DSSL

nobody    8720  0.1  0.4 1333356 16828 ?       Sl   17:11   0:07 /usr/local/apache/bin/httpd -k start -DSSL

nobody    8808  0.1  0.4 1333584 16088 ?       Sl   17:12   0:06 /usr/local/apache/bin/httpd -k start -DSSL

nobody   11467  0.1  0.2 1332816 11696 ?       Sl   18:51   0:00 /usr/local/apache/bin/httpd -k start -DSSL

root     11611  0.0  0.0   4052   188 pts/0    D+   18:56   0:00  grep httpd

The output indicates that apache process is owned by user ‘nobody’. The apache service account ‘nobody’ should be granted access to wp-content/uploads folder.


Grant access to apache service account

From the above method, we have found that nobody is the apache service account. The next step is to grant nobody user access to wp-content/uploads folder. The easiest way to grant nobody user access to wp-content/uploads folder is to assign ownership. Execute the following command to assign ownership to nobody user.

# chown nobody wp-content/uploads

This will make nobody user account, owner of wp-content/uploads and grant access.


Upload files

Now go back to your WordPress admin dashboard and try to upload files now. You can find that uploads are successful and no error is triggered. Also, you will be able to add and upgrade your plugins now, within your website.



Please don’t set 777 permission on your wp-content/uploads folder. This is really dangerous and allows anyone to access your secure data. Permissions should be 755/644.


If you need any further assistance please contact our support department.



Leave a Reply