Unable to create Directory uploads on WordPress Website
This is a common problem, Unable to create Directory uploads on WordPress Website. I’ve got a clients requirement that he can’t Upload files WordPress Website. Sometimes a simple problem isn’t just a can be done type. It has been taken two days for me to find the actual solution for myself. My clients main problem was WordPress Image Path for “unable to create directory wp-content/uploads”.
There will be many reasons for this problem. I’m trying to describe them all in depth, you’ve to check first what kind of problems you’re facing and take necessary actions. On your case it may differ the possibilities for this error showing. So, let’s wrap up…
Solve#1: Unable to Create Directory wp-content/uploads
If you’re getting unable to create directory uploads problems while you’re trying to upload/import any media file into WordPress’s Media Library, please take a look all the steps first and then decide which one is suitable for you on demand of WordPress errors.
- unable to create directory wp-content/uploads
- Unable to create directory wp-content/uploads/2017/04
- Unable to create directory /wp-content/uploads/ Is its parent directory writable by the server?
My two days taken is for the issue of “Unable to create directory /wp-content/uploads/ Is its parent directory writable by the server?”. Couldn’t find any solution for resulting this issue occurred. Then I’ve decided to write up a nice tutorial to resolve this issue.
At first you should check the easiest solution one. This is the most easiest and first Step for this issue. Check WordPress get Upload Directory first.
- Login into your WordPress Admin Dashboard
- From Main Menu Settings go Media Settings ( Settings>Media )
- In the input text field “Store Uploads in this folder”, place wp-content/uploads
- Save the setting by clicking “Save Changes” button
Usually this option will not be visible on normal WordPress Installation/New WordPress Installation. If you’ve hosted your website on a Server like Hostgator, VPS Dime or Linode and you wants to move your server elsewhere like Godaddy. Then on the above Input field you’re Upload File URL may look like this:
You need to change this kind of URL after migration of your server, because both Server URL will not be same. For global wordpress image path, use default path like this:
After Saving, this field may hide also. The main cause of this error, while install new WordPress on a fresh server then wp-content/uploads directory doesn’t exists. After exporting data/database it’s automatically extracted the old path of uploads directory to new server. That’s why this field will be enabled. After changes like above your problem will be solved.
NOTE: you’ve to make sure that “Store uploads in this folder” text field contains only wp-content/uploads
Change Default WordPress Media Uploader File Path:
If above technique will not work for you then you can follow another tricks.
What should you do if you can’t find “Store uploads in this folder” in Settings>Media page ?
- You may say that, I can’t see the above options field and still I can’t Upload any Media files via WordPress Media Manager, What I can do now? To solve this problem you’ve to add a code snippet on your “wp-config.php” file.
define( 'UPLOADS', 'wp-content/uploads' );
make sure you’ve add this line of code above this line:
require_once(ABSPATH . 'wp-settings.php');
You may wants to change your uploads directory, like you wants all images, files will be store in “assets” directory which location will be like wp-content/assets then you need to place the following code snippet:
define( 'UPLOADS', 'wp-content/'.'assets' );
Another way, if you wants to upload file wordpress directory to outside of wp-content, as like http://www.yourdomain.com/assets then you’ve to set uploads path in wp-config.php file like given below:
define( 'UPLOADS', ''.'assets' );
NOTE: Still you can choose the option in month/year to organize your uploaded files on WordPress.
If you still get “Unable to create directory /wp-content/uploads/ Is its parent directory writable” this error message then follow the steps below.
Solve#2: Change WordPress Folder Permission Manually
If above solution isn’t work for you then you’ve move for this solution. Please don’t go for just on Instructions, read carefully before any attempt it will make you safe for bigger problems. This solution is to change WordPress folder permission manually on your server. Please follow these steps-
- Change WordPress Folder Permission on wp-content directory to 775 and try to upload files again, if not then follow step 2
- Change Folder Permission 777 and try again to upload files on wordpress directory
- If still you’re being failure then do the same repetition of step 1 & 2 for wp-content/uploads directory
NOTE: 777 is very dangerous for your website and server. Do it for make sure that upload files on wordpress is right way. Revert back the permission 755( you should have use this permission of 755 for your websites security reason )
Learn more about Changing File Permissions
Solve#3: Check PHP Configuration is in Safe Mode
If still you’re a failure, then you’ve to check your Server Configurations. If your server is running on safe mode then it doesn’t allow php create directory or WordPress directory. It may possible that your upload directory is belongs to different user. You can try any of them –
- For uploading files change the owner of scripts and upload directories ( request to your hosting provider, they will do this for you )
- If available then disable php safe mode either in php.ini file or PHP Configurations.
You can check PHP Configurations by simply creating a file like below-
Solve#4: You’ve root access and your server running on Ubuntu
If you know that your webserver(Apache/Nginx) is running on Ubuntu Server then you’re quite lucky. You must have the root server access of your own server. If the server runs on Ubuntu Server then by default system is www-data and group www-data.
Ubuntu is the most advanced web server for security reason, it doesn’t allow to create files/folders by any user(www-data) doesn’t own it. In this case Ubuntu isn’t able to write folder permissions for them.
You’ve to change the filesystem permission on folder(where webserver/you wants to write) to “parent directory”, as already mentioned the error message.
to enter Root Access use –
sudo root@domain_ip/website address
you’ll ask for password, enter the server root password and follow the steps.
Just make sure the folder path is okay, use sudo if you already logged in intu current user –
chown www-data /path/to/directory
another example of the same code snippet is-
sudo chmod 755 -R /path/to/directory
Another approach via groups is –
chgrp www-data /path/to/directory
chmod g+w /path/to/directory
Hope any one solution described above will help you. If you like my post then please pay me with a social share 🙂