If you are a WordPress user, you may have encountered the “Failed to Write File to Disk” error when trying to upload files to your site. This error can be very frustrating and prevent you from updating or adding new content to your site.
In this article, we will explain what causes this error and how you can fix it in a few simple steps.
What Causes the “Failed to Write File to Disk” Error in WordPress?
The most common cause of this error is incorrect folder or file permissions on your web server. Each file and folder on your site has a set of permissions that determine who can access or modify them. Your web server controls these permissions based on the user account that runs it.
If the permissions are not set correctly, your web server may not have enough access to write files to the upload folder where WordPress stores images and other media files. This means that when you try to upload files from the WordPress admin area, the server will fail and give you an error message like this:
- WordPress failed to write to disk
- WordPress has failed to upload due to an error
- Failed to write file to disk
- Unable to create directory wp-content/uploads/2018/10. Is its parent directory writable by the server?
Another possible cause of this error is temporary folder errors. WordPress runs on PHP, which is a scripting language that handles file operations on the server. When you upload files, they are first saved in a temporary folder before being moved to their final destination. The location of this temporary folder is defined in the PHP configuration files.
Sometimes, this temporary folder can get full or corrupted due to large uploads or interrupted processes. If this happens, the uploaded files may not be saved properly and cause errors when trying to access them from the WordPress admin area.
A third possible cause of this error is quota limit exceeded. Every user account on your web server has a limited amount of disk space allocated for their site. This space is used for storing all the files and folders on your site, including images, videos, documents, etc.
If you exceed this quota limit, either by uploading too many files or by having too many subdomains or plugins installed on your site, you may run out of disk space and get an error message like this:
- Quota exceeded
- Disk space full
- Insufficient storage space
How Can You Fix the “Failed to Write File to Disk” Error in WordPress?
To fix this error, you need to check and adjust both the folder and file permissions on your web server and clear any temporary folders that may be causing problems.
Check and Adjust Folder Permissions
The first thing you need to do is connect to your web server using an FTP client like FileZilla1. FTP stands for File Transfer Protocol, which allows you to transfer files between your computer and your web server.
Once you are connected, right-click on the wp-content folder (which contains all your media files) and select “File Permissions”. This will open a dialog box where you can see and change the permissions for different users (owner, group, public).
The recommended permissions for wp-content are 755 for owner (rwx), 644 for group (rw-), and 644 for public (rw-). To set these permissions using FTP client2, enter 755 into the Numeric value field for owner; enter 644 into Numeric value field for group; enter 644 into Numeric value field for public; check Recurse into subdirectories; click Apply To Directories Only; click OK.
After changing these permissions, right-click on wp-content again and select “File Permissions”. This time, change permissions for individual files inside wp-content using FTP client2. Enter 644 into Numeric value field for owner; enter 644 into Numeric value field for group; enter 644 into Numeric value field for public; check Recurse into subdirectories; click Apply To Files Only; click OK.
Clear Temporary Folder
The next thing you need to do is clear any temporary folders that may be causing errors when uploading files. To do this using FTP client1, navigate back up one level from wp-content until you reach root directory (/). Then right-click on .htaccess file (which contains some configuration settings) and select Rename. Change its name from .htaccess.txt (which means it is hidden) back .htaccess (which means it is visible). Then right-click on .htaccess file again and select Delete.
This will delete all hidden files in root directory (/), including any temporary folders that may be holding corrupted or incomplete uploads. After deleting these folders using FTP client1, go back up one level from root directory (/) until you reach public_html directory (which contains all public-facing directories). Then right-click on index.html file (which contains some basic HTML