How to Fix Unable to create directory wp-content/uploads

How to Fix Unable to create directory wp-content/uploads

The Unable to create directory wp-content/uploads error message may occur when you try to upload media to your WordPress site.

There are several things that can cause this error, such as incorrect file permissions, full hosting disk space, or an incorrect upload location configuration (for example, when changing the wp-content/upload folder name configuration)

If you receive this error message, you can try the following options so you can upload media to your WordPress site.

How to Fix the Unable to create directory wp-content/uploads Error in WordPress

Because there are several possibilities that cause this error, you certainly need to check each possibility, including:

  • Check file and folder permissions
  • Check available disk space
  • Check wp-config configuration
  • Check the .htaccess file

1. Check File and Folder Permissions

The first step you need to take is to check the file and folder permissions for the files and folders in WordPress.

Folders usually use 0755 permissions and files use 0644. You can check every folder that leads to the upload location mentioned in the error message.

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

For example, if you get an error message like the one above, you need to check every permission on the folder wp-content, wp-content/uploads, wp-content/uploads/2024, and wp-content/uploads/2024/04.

If you are using cPanel, you can change file and folder permissions by following this tutorial: How to Change File Permissions in cPanel. But if you are using a VPS without a control panel, you can change file permissions using chown or chmod

chown -R www-data:www-data {path-instalasi-wordpress}/wp-content/uploads

or

sudo chmod 0775 {path-instalasi-wordpress}/wp-content/uploads

2. Check Hosting/VPS Disk Space

Besides problematic file permissions, this error can also occur because the disk space or inodes on the hosting or VPS you are using are full.

If you are using cPanel, you can check the usage amount from the cPanel dashboard page, then check which folder is using the most disk space through the Disk Usage page by following this tutorial: How to Find Large Files in cPanel

When it turns out that the disk space on your server or hosting is full, you can delete unused files such as error_log, tmp, and so on, or upgrade your hosting or VPS if possible.

3. Check wp-config.php Configuration

When you try to change the upload folder name, for example, wanting to change it to wp-content/media instead of wp-content/uploads but only changing the folder name, then this error will most likely occur.

The solution is that you can set the upload folder location through the wp-config.php file by adding the following line above the line /* That’s all, stop editing! Happy publishing. */

define('UPLOADS', 'wp-content/uploads');

Make sure to change wp-content/uploads with another folder name according to the folder name you are using.

4. Check the .htaccess File

You could say that .htaccess is the key to how the server will process the scripts you add to the server or hosting, and there are certainly rules using .htaccess that can cause you to be unable to upload files into the wp-content/uploads folder.

It is recommended to create a backup of the .htaccess file currently in use, then change it with the following default WordPress .htaccess file to check whether the error occurred because of an incorrect .htaccess or not

# BEGIN WordPress
RewriteEngine OnRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]RewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]
# END WordPress

Those are some ways you can apply to fix the Unable to create directory wp-content/uploads error in WordPress. If you are still a beginner and are not sure how to do it, it is recommended to contact someone more experienced or contact your hosting provider.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...