[wp-testers] Upload via XMLRPC broken in 2.0
Ryan Boren
ryan at boren.nu
Thu Dec 29 01:40:44 GMT 2005
On Wed, 2005-12-28 at 17:38 -0800, Ryan Boren wrote:
> On Thu, 2005-12-29 at 09:19 +0900, ecto Support wrote:
> > Hi,
> >
> > It might have been discussed on the list before, but uploads via
> > XMLRPC in 2.0 is completely broken. The errors returned are always
> > <string>Could not write file banner.jpg</string>. An upload via the
> > control panel creates a directory uploads/2005/12/ for example, but
> > that doesn't occur with xmlrpc. Are there any plans to fix this,
> > since I got a bunch of ecto-using wordpress bloggers who would love
> > to be able to upload again.
>
>
> wp_upload_bits() in functions-post.php handles writing the bits. In that
> function is this line:
>
> $ifp = @ fopen($new_file, 'wb');
>
> Removing "@" will cause the error text to be output so that we can see
> exactly why fopen isn't working.
>
> $ifp = fopen($new_file, 'wb');
Actually, I spotted a typo. There's an extra 's' on $upload.
--- wp-includes/functions-post.php (revision 3374)
+++ wp-includes/functions-post.php (working copy)
@@ -907,7 +907,7 @@
while ( file_exists($upload['path'] . "/$filename") )
$filename = str_replace("$number.$ext", ++$number .
".$ext", $filename);
- $new_file = $uploads['path'] . "/$filename";
+ $new_file = $upload['path'] . "/$filename";
$ifp = @ fopen($new_file, 'wb');
if ( ! $ifp )
return array('error' => "Could not write file
$new_file.");
More information about the wp-testers
mailing list