WordPress is a powerful content management system which allows users to upload media files into the website. But when you try to upload the media file, it shows you the WordPress failed to write file to disk error. This error is very frustrating. Sometimes WordPress show some error which is quite frustrating for the Beginners due to the lack of information.
WordPress error can be fixed with the right information or with the help of the expert. You don’t need to worry about the error because it is common to have an error in WordPress website. To fix failed to write file to disk error first learn the reasons why the error is caused and then try to fix it. In this article, I will tell you the causes of the WordPress failed to write the file to the disk error and how to fix it.
What is WordPress failed to write file to disk error?
If you upload media files to your WordPress website through the admin area, it is possible you see this error. When this error occurs, you could see one of the following 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 a directory wp-content/uploads/2018/10. Is its parent directory writable by the server?
What Causes the WordPress failed to write file to disk error
Failed to write file to disk error could be caused due to many reasons. Incorrect permission of the upload folder is one of the common causes for this error. Every file and folder on the WordPress site has its own set of permissions. The web server controls these files according to these permissions.
Invalid permissions to the folder can disable your access to write files on the server. It means the web server has no access to add or create files to the folder.
- Due to following reasons failed to write the file to disk error in WordPress is caused.
- You set Invalid permissions for the files and the folders.
- Your disk quota has no space for the media files.
- Outdated plugins or some plugins cause problems.
Also Read: How to Fix a 502 Bad Gateway Error in WordPress
Let’s discuss the causes of WordPress media upload error and how to fix them.
Check the Permissions of the Upload Folder
As I have mentioned above, permissions of the upload folder are a very common issue of the WordPress failed to write file to disk error. When you try to upload files to any folder on your site, the server checks the permissions of the folder about upload or write files on the website. If the folder doesn’t have the certain permissions, the server restricts the user to write files to the folder. The same procedure is for changing the files because they also have the permissions to change or replace the files. Following are the ways of modifying permissions of the folder on the server.
Check Permissions with FTP Client
To change the permission of the files or folders of the website use the FTP client. First, you have to log in to your WordPress root folder with FTP then click on the WP-content folder and select the option file permissions. A window will pop up on the screen.
Now enter 755 in the Numeric value section. After that tick mark the checkbox of Recurse into subdirectories, now select the option to apply to directories only and click on the OK button. By doing this, FTP client will set the permissions to 755, and it will apply to all subfolders in WP-content.
Again open the WP-content folder and click on file permissions. Now change the file permissions for files.
Now enter 644 in the Numeric value section and then tick mark the checkbox of Recurse into subdirectories. Now click on apply to files only and click OK button. This will set permissions to 644, and it will apply to all the files in the WP-content folder.
Check Permissions Using cPanel File Manager
In order to change permissions for the files and folders login to your cPanel. After that, click on the file manager to change the permissions. Now open public_html/wp-content folder, you can see the uploaded files here.
Now right click on the upload file and select permission options. The file permissions should be 755. If the permissions of the folders are not 755, then change them to 755 and click on change permission button to save the permissions. By doing this, you can upload media files on your website without getting media to upload failure error.
Also Read: How to Detect and Clean WordPress Malware Redirect
Get More Space
Some users ignore the allocation for the disk space while purchasing their hosting plan. This gives the possibility of running out of disk space. The cheap shared plan comes with very low disk space which leads to the short disk space and soon you have no space to add media files. If you are using a website loaded with the media files, you exceed your disk quota very soon.
You can check the disk usage after login to the cPanel, in left sidebar with detailed statics. If the disk space is low, try to delete extra files or the ones you are not using to make some space then you will upload media files to the WordPress website. Or you can change your hosting plan to get more disk space.
Empty Temporary File Directory
You can upload the images and files to the WordPress website once the permissions are set. If you still cannot upload the files, then your temporary file directory could be full. WordPress website uses temporary file directories during files transfer in PHP. To remove this problem, you can contact your host in order to clean out the directory because this directory is mostly hidden and you cannot access the directory with FTP client.
It cannot be denied that the plugins will allow you to add many more features to your WordPress website. However, you can install a plug-in that will lead to this error. During your analysis, you must disable the plug-ins to find out which one should be removed to correct the error. Sometimes plugins cause real trouble. Plugins are for the betterment of the website, but outdated or unworthy plugins cause problems. You do not need to install too many plugins for the security of your WordPress website.
We hope that this article will help you solve the error “Failed to write file to disk” on WordPress. There are cases where you cannot get rid of the error, even though you have tried the above solutions. At this point, it’s time for you to contact your web host and describe your situation in as much detail as possible. If you are faced with a server problem, you can find your way under the guidance of technicians.