- sunsoft.pk
- February 27, 2024
Experiencing the ‘Upload: failed to write file to disk’ error while trying to upload files in WordPress?
This prevalent error can be particularly frustrating for beginners as it hinders the process of uploading files to your WordPress site.
In this article, we will guide you on how to resolve the ‘Upload: failed to write file to disk’ issue in WordPress.
What Causes the ‘Failed to Write File to Disk’ Error in WordPress?
This WordPress error can occur due to various reasons, but the most common one is incorrect folder permissions.
Each file and folder on your website comes with a specific set of permissions, controlling access to the files by the web server. Incorrect permissions for a folder can impede your ability to write files on the server, meaning the web server cannot create or add new files to that particular folder.
If you attempt to upload images or any other files from the WordPress admin area, you may encounter one of the following error messages:
- 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/2016/03. Is its parent directory writable by the server?
With this understanding, let’s delve into troubleshooting the ‘Upload: failed to write to disk’ error in WordPress.
How to Fix the ‘Upload Failed to Write to Disk’ Error in WordPress
First, establish a connection to your WordPress website using an FTP client.
For this tutorial, we are using the free FileZilla FTP client. If you are using a different FTP client, the interface may look slightly different.
Once connected, right-click on the ‘wp-content’ folder and select ‘File permissions.’
This action will open the file permissions dialog box in your FTP client, displaying permissions for the owner, group, and public.
You need to enter ‘755’ into the Numeric value field. After that, check the box next to ‘Recurse into subdirectories.’
Next, click on the ‘Apply to directories only’ option and then click the ‘OK’ button to proceed.
Your FTP client will now set folder permissions to ‘755’ and apply them to all sub-folders inside ‘wp-content,’ including the ‘uploads’ folder where all your images are stored.
Ensure that file permissions for individual files in your ‘wp-content’ folder are also correct.
Once again, right-click on the ‘wp-content’ folder and select ‘File permissions.’ This time, permissions for files will be adjusted.
Enter ‘644’ into the Numeric value field and check the box next to ‘Recurse into subdirectories.’
Now, click on the ‘Apply to files only’ option.
Click the ‘OK’ button to continue. Your FTP client will set file permissions to ‘644’ for all files in the ‘wp-content’ folder.
Visit your WordPress website and attempt to upload files.
If the error persists, contact your WordPress hosting provider and request them to empty the temporary files directory.
WordPress uploads your images using PHP, which initially saves the uploads to a temporary directory on your web server before moving them to your WordPress uploads folder.
If this temporary directory is full or improperly configured, WordPress cannot write the file to disk.
As this temporary folder is located on your server, in most cases, you cannot access it using FTP. Contact your web host and ask them to empty it for you.