How to Fix WordPress Failed to Write File to Disk Error in 3 Ways

How to Fix WordPress Failed to Write File to Disk Error in 3 Ways

When you see the Upload: Failed to Write File to Disk error on your WordPress site whilst trying to upload a photo for that awesome post you just put together, the only reaction can be pure frustration. And while this problem is not desirable, debugging this WordPress error is quite easy. In this tutorial, we will discuss various causes of the error, and show you how to fix it with easy-to-follow steps.

Download all in one WordPress cheat sheet

Why You Get Upload: Failed to Write File to Disk Error

The Upload: Failed to Write File to Disk WordPress error can surface due to a number of reasons. The most typical cause of the error is incorrect folder permissions. But besides incorrect permissions, this error can also occur due to your website exceeding the quota limit of the hosting service. Finally, in some rare cases, you might be experiencing this error due to the file capacity of the temporary folder of WordPress. Needless to say, all three cases of the error are fixable, and we will show you the solutions to each and every one of them in the following steps.

Option 1 – Checking Uploads Folder Permissions

As stated above, this is the most common cause of the Upload: Failed to Write File to Disk WordPress error. Whenever you try to write (upload) files to any one of the folders on your website, the web server checks whether the folders are allowed to write those files. If any folder does not have the appropriate permissions, the web server is unable to write files to that folder. The same goes for making changes to particular files, as they also have permissions which determine the interact-ability with that file. There are three methods of modifying folder permissions on your web server:

Option 1.1 – Changing Permissions with FTP Client

You can change permissions of files/folders of your website using FTP clients like FileZilla. First, connect to your hosting using FileZilla. Then, hover over to WordPress installation folder (usually it’s public_html) and to wp-content folder. Now right-click on the folder Uploads. Select File Permissions. You will now see a new dialog box open up; in the Numeric value section, enter 755. Now, check the Recurse into subdirectories option. This will apply the same permission to all folders inside Uploads. Finally, choose Apply to directories only in the sub-menu. Finish by clicking OK.

Fixing Upload:Failed to Write File to Disk with FileZilla

Keep in mind that sometimes, merely changing folder permissions does not work – you have to change permissions for files residing inside the folder as well. You can achieve this using FileZilla as well. Once again, right-click on the wp-content folder and choose the File Permissions option. Next, enter 644 in the Numeric value field. Finally, check ‘Recurse into subdirectories’, and this time, select Apply to files only. Click OK to save your settings.

Option 1.2 – Changing Permissions with Hostinger File Manager

If you’re using a WordPress hosting service like Hostinger, you can change folder permissions easily through the control panel provided by the service. To do this, log in to your web hosting account and go to Files File Manager.

The File Manager on Hostinger's hPanel.

Then, navigate to the public_html  wp-content folder. Once inside, you should be able to see the Uploads folder. Right-click on this folder, and then hit on the Permissions button. Now, set the permission to 755 (read and write) for this folder, if it isn’t already set.

Try to upload image again and if the error still pops up, proceed to changing the permissions on individual files inside the Uploads folder as well, just like in the previous step.

Changing File Permissions with Hostinger File Manager

Option 1.3 – Changing Permissions via SSH

Important! It’s recommended to check tutorial on how to manage permission and owners via command line before proceeding with this step.

On Hostinger VPS hosting, you can change file/folder permissions via SSH (see our tutorial on how to connect to your account or VPS with SSH). To change permissions using SSH, you only need to use the chmod command, like this:

  1. First of all, access WordPress installation folder. For example, if your WordPress is inside public_html folder, execute:
    cd public_html
  2. Now change permissions to 755:
    chmod 755 wp-content

    By running the above command, the wp-content folder’s permission will be set to 755. If you want to give the same permission to all files and folders inside this directory, simply add the -R flag before 755 in the command.

Option 2 – Checking Quota Limit

Another cause for Upload: Failed to Write File to Disk WordPress error is if your website has exceeded the space limit of the web hosting service. On Hostinger web hosting, disk space and other limits also varies.

Contrary to popular belief, exceeding the quota limit of your hosting provided isn’t that uncommon, especially if your website is rich in content. If that is indeed the case, you would want to delete some unused files on the server. 

Option 3 – Checking Temporary Folder

If the error still persists, you can be sure that the temporary folder of your WordPress site is filled to its maximum capacity. WordPress works by uploading your content to a temporary location on the server, and then proceeds to save this content in the Uploads folder. But if the temporary folder doesn’t have room itself, then there is no way for that content to reach the Uploads folder and Upload: Failed to Write File to Disk error occurs.

If this is the case, you will need to contact your hosting provider. If you are on VPS, here are instructions how to clean up disk space on VPS.

Conclusion

In this tutorial, we saw how to fix Upload: Failed to Write File to Disk WordPress error. The error can be caused by:

  • Incorrect file/folder permissions
  • Exceeding quota limit of web hosting provider
  • Overflow of the temporary folder

Hopefully, by following this guide, you were able to solve this error and continue saving media content on your WordPress website. 

Author
The author

Domantas G.

Domantas leads the content and SEO teams forward with fresh ideas and out of the box approaches. Armed with extensive SEO and marketing knowledge, he aims to spread the word of Hostinger to every corner of the world. During his free time, Domantas likes to hone his web development skills and travel to exotic places.