WordPress 2.0 breaks upload (fixes)

WordPress 2.0.1 fixes all the issues below.

I recommend not to upgrade to WordPress 2.0 yet as it breaks file upload via ecto and other blog clients. I posted a message to the wordpress-testers mailing list and am hoping they can fix the bug. I have upgraded my test install of WordPress to 2.0 and have not found a work-around for the upload bug, unless I hack around which I refuse to do. It worked in a previous 2.0 beta version that I had used, and there were several changes in the xmlrpc.php file between the two versions and all related to the upload function. It seems that WordPress developers have suddenly decided to put uploads in directories based on date, such as 'uploads/2005/12/something.jpg'. Why is beyond me as that totally kills the option to define your own sub-directories.

UPDATE: After a few back and forth emails with Ryan Boren from WP via the above mailing-list, fixes were made and uploads now work again. To get the current 2.0 working, please apply the following changes to wp-includes/functions-post.php:

Replace line 897:

$new_file = $uploads['path'] . "/$filename";


$new_file = $upload['path'] . "/$filename";

Yes, that's one single 's' you have to remove...

Replace line 912:

return array('file' => $new_file, 'url' => $url);


return array('file' => $new_file, 'url' => $url, 'error' => false);

However... with these fixes in place, you cannot specify destination directories anymore. In ecto, if you reveal the attachment settings sheet, you must leave the “Destination:” field blank. If you prefer to specify your own upload sub-directories, use the xmlrpc.php file from an earlier 2.0 beta version, which I kept around.

UPDATE 2: after some more email discussion, it looks like WP will revert to the old upload behavior. So, I still recommend to use the xmlrpc.php from an earlier beta that still allows specifying sub-directories.

Technorati Tags: wordpress

Posted by Adriaan on December 29, 2005