Error while updating your WordPress Installations Automatically or Getting error while uploading file to WordPress blog “Failed to write file to disk.”, Here is a solution for this errors.

If you are getting an error while uploading a file or image to your WordPress blog or when automatically updating your WordPress installation, then here is the solution for the same.

All errors are related to something like this:

Error 01:

Error while uploading file, image to WordPress blog “Failed to write file to disk.”

Error 02:

Automatic update Failed for WordPress 3.8.2

OR

Warning: touch() [function.touch]: Unable to create file ~/root-directory/tmp/wordpress-3.tmp because No such file or directory in /nfs/ccc/hhh/ttt/12345/domains/your-domain-name.com/html/wp-admin/includes/file.php on line 155

Warning: unlink(~/root-directory/tmp/wordpress-3.tmp) [function.unlink]: No such file or directory in /nfs/ccc/hhh/ttt/12345/domains/your-domain-name.com/html/wp-admin/includes/file.php on line 479
Download failed.: Destination directory for file streaming does not exist or is not writable.

Here is the Reason & Solution to the problem:

This error message is typically caused by using the “/tmp” directory rather than the “~/data/tmp” directory for temporary file storage because the “/tmp” directory is shared by the entire shared hosting or GRID rather than using the disk space allocated to your specific shared hosting or GRID service, it can sometimes become full during peak hours or times of high activity. Most CMS software will allow you to configure a specific directory for uploads and temporary storage; it is recommended that you configure this as “~/data/tmp” to avoid this issue.

For WordPress sites, adding or modifying the following line in the “wp-config.php” file should resolve the issue:

Please follow these steps.

Step 01:
Add the following code in ‘wp-config.php’ at the top of the document

/* Change Grid Server Shared TEMP Directory Path */
define('WP_TEMP_DIR', ABSPATH . ’scrap/‘);

Step 02:
Now, create a folder named ‘scrap’ in your WordPress installation’s root directory, which is exactly where your wp-config.php file is located.

Step 03:
Now change File / Folder Permissions for a folder named ‘scrap’ to this: drwxr-xr-x
i.e., Allow all read and execute access to Owner, Group, and everyone but choose write access to Owner only, which is again ‘755’.

file-folder-permission

Now you should able to update your WordPress installation with ease.

Thanks & regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.