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 error while uploading file or image to WordPress blog or You are getting erro while automatically updating your WordPress installation then here is the solution fo 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 this steps.

 
Step 01:

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

 

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

 
Step 02:

 
Now create folder named ‘scrap’ in your WordPress installations root directory exactly where your wp-config.php file is located.

 
Step 03:

 
Now change File / Folder Permissions for folder named ‘scrap’ to this: drwxr-xr-x

i.e. Allow all read & execute access to Owner, Group & to everyone but choose write access to Owner only that is again ‘755’.

 
file-folder-permission

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

 
Thanks & regards
Mandar Apte

Leave a Reply

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