One of the frustrating error that WordPress users can encounter is the ‘Upload: Failed to write file to disk’ error. This error pops up while uploading files in WordPress.
Read further to know the cause and how to fix it the Upload: failed to write file to disk error in WordPress.
What is the cause of Upload: failed to write file to disk error in WordPress?
There are many reasons due to which this error can occur. Incorrect folder permissions are one of the most common reasons for this error.
The file and folders of your website have a set of permissions. Based on these permissions, your web server controls access to the files. If there is an incorrect permission to a folder, the ability to write files on the server can be taken away. Which means, your web server cannot create or add new files to that particular folder.
You might one of the following error messages when you try to upload images or any other files from WordPress admin area:
- Unable to create directory wp-content/uploads/2016/03. Is its parent directory writable by the server?
- WordPress has failed to upload due to an error failed to write file to disk
- WordPress failed to write to disk
How to fix Upload Failed to Write to Disk Error in WordPress?
Firstly, you’ll have to connect to your WordPress site using an FTP client such as Filezilla.
After connecting to WordPress via an FTP client, right click on the wp-content folder and select file permissions.
After clicking on ‘File permissions,’ a file permissions dialogue box will open. It shows you file permissions for froup, owner, and public.
Enter 755 in the numeric value field.
And then, check the box next to ‘Recurse into subdirectories.’ After that, click on ‘Apply to directories only’ radio button.
And then, click on OK button to continue.
Your FTP client will now set folder permissions to 755 and apply it to all subfolders inside wp-content. It includes uploads folder where all your images are stored.
You’ll have to make sure that file permissions for individual files in your wp-content folder are incorrect.
After the above steps are done, again right click on the wp-content folder and select file permissions. Now, we’ll change permissions for files. Enter 644 in the numeric value and then check ‘Recurse into subdirectories.’
Now visit your WordPress site and try uploading files. The above method should solve the issue. If not, then you need to contact your WordPress hosting provider and ask them to empty the temporary files directory.
Your images are uploaded using PHP by WordPress. PHP first saves the uploads to a temporary directory on your web server. From there, it moves them to your WordPress uploads folder. If this directory is poorly configured or full, then WordPress will not be able to write the file to disk.
This temporary folder in most cases cannot be accessed using an FTP client as it is located on your server. Hence, you need to contact your web host and ask them to empty it for you.
We hope that this article helped you to remove Upload: failed to write file to disk error in WordPress. If you know any other method to remove this error, please share with us in the comment section.