Wordpress FTP update trouble

Sometimes when you update wordpress or plugins, especially if you use safe mode, you can get errors like this:

1
2
3
4
5
6
7
Enabling Maintenance mode.

Downloading update from http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip.
wp-content/uploads/all-in-one-seo-pack.tmp
Warning: touch() [function.touch]: Unable to create file wp-content/uploads/all-in-one-seo-pack.tmp because No such file or directory in **\*\*\***/wp-admin/includes/file.php on line 185

Download failed. Could not create Temporary file

That’s because wordpress uses strange things for temporary directory. To cure it with non intrusive methods, just add

1
define('WP_TEMP_DIR',ABSPATH.'wp-content/uploads/');

to the bottom of your wp-config-file. That’s it. Took me about two hours to figure out -_-

UPD. If you have an error “Division by Zero” - then try using the following modification:

1
2
$path = $ABSPATH .’wp-content/uploads/’;
define(‘WP_TEMP_DIR’,$path’);

Thank for this goes to Rookian (Rookian.com).