Media content is one of the key features of attractive websites. So all WordPress users should know how to avoid errors with media uploads and how to fix them.
The 'WordPress failed to write file to disk' error makes it impossible to upload a file to the Media Library. There are three main sources of this problem covered in this article.
The troubleshooting isn't difficult. This guide is easy to follow even for beginners.
It outlines how to deal with each of the three common causes. But before fixing it, it's important to explain why the error occurs.
Understanding the problem is the first step of successful troubleshooting. The solution depends on the cause of the issue.
The error has three common sources:
1. incorrect file permissions
2. no more space in the WordPress temporary directory
3. reaching the disk storage limit.
File permissions are part of security measures in WordPress. They control which users can access a file and what actions they can perform.
Incorrect setup can block WordPress users from reading, running, or modifying files hosted on the account.
The uploads folder permissions may prevent certain users from 'writing' to the disk. This includes uploading new files.
This can be the cause of the 'WordPress failed to write file to disk' error. To check if this is your case, use the Site Health tool:
1. Go to the WordPress dashboard menu and click on Tools.
2. Choose Site Health from the list and click on the Info.
3. Go to the last dropdown menu and check the file permissions for the uploads directory. It should be Writable.
If the setting is different, this is the cause of the issue.
Sometimes the source of the error doesn't lie with the file permissions. There's just no more space in the WordPress temporary file directory.
The third common reason why users can't upload files is that they have reached the disk storage limit.
A hosting plan determines how much disk space users have on the webserver. When they run out of space, they can't add any more files and they get the 'WordPress failed to write file to disk' error.
Having identified what's causing the error, follow the instructions below to fix it.
There is a way for users to change the incorrect file permissions. Or they can make more space in the temporary folder.
It's also possible to resolve the problem of exceeding the quota limit. Follow the process below that corresponds with the cause of the error.
The number one source of the 'Failed to write file to disk' error is incorrect file and folder permissions. File permissions protect websites from unauthorized access and modification that could harm them.
Before a server 'writes' (or uploads) files to any folder, it checks the folder permissions. If the folder permissions prevent 'writing', the web server will block the upload.
The basic rule in WordPress for correct folder and file permissions is 644 for files and 755 for folders. Users can change the incorrect permissions via an FTP client, cPanel, or SSH.
Here are the instructions for each process.
1. Log in to an FTP client, such as FileZilla. Check the hosting account dashboard to find your credentials.
2. Go to the root folder public_html > wp-content.
3. Right-click on the wp-content folder and select File Permissions. The file permissions dialog box will open.
It displays the current settings for Owner permissions, Group permissions, and Public permissions.
4. Enter 755 as the Numeric value.
5. Tick the box 'Recurse into subdirectories'.
6. Select 'Apply to directories only'.
7. Press 'OK'.
The FTP client uses the 755 permissions for all subdirectories in the wp-content folder. So it will change the permissions for the Uploads folder within the wp-content too.
Next, set up the individual file permissions inside the wp-content folder. Here are the steps:
1. Locate the wp-content folder and right-click on it.
2. Select File Permissions.
3. This time set the Numeric Value to 644 in the file permissions dialog box.
4. Tick the box ‘Recurse into subdirectories’.
5. This time, select 'Apply to files only'.
6. Press 'OK'.
The FTP client uses the 644 permissions for all files within the wp-content folder. This includes Uploads.
This process should remove the 'Failed to write file to disk' error and the upload should be working again.
1. Open cPanel.
2. Go to the File Manager.
3. Choose the name of the file to modify.
4. Select the option 'Change permissions'.
5. Set up the correct numeric value.
6. Click on 'Change permissions'.
1. Go to the WordPress root folder. If your WordPress files are in the public_html folder, execute: cd public_html
2. Set the permissions to 755: chmod 755 wp-content
The wp-content folder’s permission will be set to 755. To set the same permissions to all files and folders inside the wp-content folder, add the -R flag before 755 in the command.
WordPress file permissions aren't the only cause of the 'Failed to write file to disk' error. It may be necessary to empty the temporary file directory.
WordPress uses a temporary folder on a webserver to temporarily store the files users upload. From there the files can be moved to the Uploads folder.
But if there is not enough room in the temporary folder, users get the 'Failed to write file to disk' error.
If that's the case, contact the web hosting provider. It's not possible to clear the temporary files directory using FTP.
A web host provider usually offers different plans. These allocate a certain amount of storage space to a website on a server.
The maximum storage limit is also called the 'quota limit'.
When users exceed their allocated storage space, they can't upload more files. Instead, they will get the 'WordPress failed to write file to disk' error.
If you think this is the cause of the upload problems, contact the web hosting provider. It may be possible to change plan and get more disc space.
Another option is to free up some storage space by deleting old files that are no longer needed. Do this using FileZilla or cPanel.
Uploading files doesn't always go smoothly. But following the steps outlined in this post should fix the issue.
This article covered the three main reasons why users get the error message.
When uploading fails, it may be necessary to change folder permissions. In other cases, the temporary files directory is full and the web host will have to fix that.
Finally, WordPress can fail to write files to disk when users reach the allocated storage limit on their web hosting server. They can delete some files to free up space or get a new web hosting plan.
If you enjoyed reading this article on WordPress failed to write file to disk error, you should check out this one about WordPress briefly unavailable for scheduled maintenance error.
We also wrote about a few related subjects like failed to open stream error, WordPress post missed schedule, failed to load resource error, WordPress posting to Facebook done automatically, Wordpress mixed content errors, how to reorder pages in WordPress and WordPress updating failed error.
Free cheat sheets available
Subscribe to download a set of cheat sheets for CSS, JS, and HTML
You'll receive an email with the cheat sheets in an instant.