[wp-testers] Upload via XMLRPC broken in 2.0

ecto Support ecto at kung-foo.tv
Thu Dec 29 01:52:51 GMT 2005


No difference in the result, tho, and this time no filemanager  
warnings, even.

Request with URL:
http://127.0.0.1/~adriaant/wordpress/xmlrpc.php
and data:
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>metaWeblog.newMediaObject</methodName>
<params>
	<param>
		<value><string>1</string></value>
	</param>
	<param>
		<value><string>admin</string></value>
	</param>
	<param>
		<value><string>******</string></value>
	</param>
	<param>
	<value><struct>
	<member>
		<name>bits</name>
		<value>REMOVED</value>
	</member>
	<member>
		<name>name</name>
		<value><string>testfile.jpg</string></value>
	</member>
	<member>
		<name>type</name>
		<value><string>image/jpeg</string></value>
	</member>
	</struct></value>
	</param>
</params>
</methodCall>

Response:
<?xml version="1.0"?>
<methodResponse>
   <fault>
     <value>
       <struct>
         <member>
           <name>faultCode</name>
           <value><int>500</int></value>
         </member>
         <member>
           <name>faultString</name>
           <value><string>Could not write file testfile.jpg</string></ 
value>
         </member>
       </struct>
     </value>
   </fault>
</methodResponse>



On Dec 29, 2005, at 10:40, Ryan Boren wrote:

> 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.");
>
>
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers



More information about the wp-testers mailing list