As a WordPress user, you may have experienced the frustrating error message, “Upload failed to write file to disk” when trying to upload media files to your website.
This error can occur due to various reasons such as incorrect file permissions, lack of storage space, or corrupted upload directory. In this tutorial, we will show you how to fix the “Upload Failed to Write File to Disk” error in WordPress.
Why does the “Upload Failed to Write File to Disk” Error Occur in WordPress?
The “Upload Failed to Write File to Disk” error message can occur due to several reasons, including:
Incorrect File Permissions: Incorrect file permissions can cause the error message to appear when you try to upload media files to your website. If your web server does not have permission to write to the uploads directory, you will get the “Upload Failed to Write File to Disk” error.
Insufficient Storage Space: If your website has used up all the available storage space, you will not be able to upload media files to your website, and you will receive the “Upload Failed to Write File to Disk” error.
Corrupted Upload Directory: A corrupted upload directory can also cause the “Upload Failed to Write File to Disk” error. The upload directory is the folder on your server where WordPress stores all your media files. If this directory becomes corrupted, you will not be able to upload any media files to your website.
Now that you know why the “Upload Failed to Write File to Disk” error occurs let’s dive into how to fix it.
How to Fix “Upload Failed to Write File to Disk” Error in WordPress
Method 1: Change File Permissions
The first method to fix the “Upload Failed to Write File to Disk” error is to change file permissions. Follow these steps to change file permissions:
Log in to your WordPress site via FTP.
Navigate to the wp-content folder and right-click on it.
Click on the “File Permissions” option.
Change the numeric value in the “Numeric value” field to 755.
Check the “Recurse into subdirectories” checkbox.
Click on the “Apply to directories only” radio button.
Click on the “OK” button to save the changes.
Now try uploading the media file again to see if the error message disappears.
Method 2: Increase PHP Memory Limit
The second method to fix the “Upload Failed to Write File to Disk” error is to increase the PHP memory limit. Follow these steps to increase the PHP memory limit:
Create a blank text file and name it php.ini.
Add the following line of code to the file: memory_limit = 256M
Save the file and upload it to the /wp-admin/ folder on your server.
Try uploading the media file again to see if the error message disappears.
Method 3: Check Your Available Storage Space
The third method to fix the “Upload Failed to Write File to Disk” error is to check your available storage space. Follow these steps to check your available storage space:
Log in to your web hosting control panel.
Navigate to the Disk Usage section.
Check how much disk space you have used and how much is remaining.
If you have used up all the available disk space, you will need to free up some space before you can upload any media files to your website.
Method 4: Rename the Uploads Directory
The fourth method to fix the “Upload Failed to Write File to Disk” error is to rename the uploads directory. Follow these steps to rename the uploads directory:
Log in to your WordPress site via FTP.
Navigate to the wp-content folder and locate the wp-content folder
Select file permissions
Enter 755 in the numeric field box
Check box next to ‘Recurse into subdirectories’
Click ‘Apply to directories only’ option.
Click continue
You can now visit your WordPress site and try uploading files again.
If you still see the error, then you will need to contact your WordPress hosting provider and ask them to empty the temporary files directory.