When trying to update stock Twenty Fourteen theme today, I ran into a theme update failing problem. The error message is “Download failed. Failed to write request to temporary file.”. The first reaction was file / folder permission setting. But it wasn’t the case this time.
Typical permission error message should be something like “unable to create directory” etc, the update failing could be “temporary directory” related. So I made following change in WP-CONFIG.PHP.
// Setup a temporary folder for uploading and updating define('WP_TEMP_DIR', ABSPATH . 'wp-content/');
This fixed the problem in a heartbeat.
I still don’t quite understand why this happened, because this is a site that has been running stable for over a year. No similar error in either updating theme or plugin. You should also notice that, WP_TEMP_DIR is absent in a default WP-CONFIG.PHP.
This tip also works, in case you met error message like this: “Destination directory for file streaming does not exist or is not writable”
[Update: Sep 08, 2014]
This should be a server configuration issue. The web server is not configured properly to a temporary folder like “/tmp”. Using web-accessible directory like the one mentioned above can be a security risk.
Remove the line from WP-CONFIG.PHP after fixing the problem, and ask hosting company for a proper fix.