[wp-trac] [WordPress Trac] #24156: If you submit file through wp curl it doesnt send boundary params for file mutlipart

WordPress Trac noreply at wordpress.org
Mon Apr 22 17:40:41 UTC 2013


#24156: If you submit file through wp curl it doesnt send boundary params for file
mutlipart
--------------------------+------------------------------
 Reporter:  samnani       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  HTTP          |     Version:  3.5.1
 Severity:  major         |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> If you submit file through wp curl it doesnt send boundary params for
> file multipart, because in class-http.php at line 174 $r['body] array is
> converted to string ($r['body'] = http_build_query( $r['body'], null, '&'
> );)
>
> And curl wants array to send file boundary to rest api , in that case it
> fails.
> ex.
>
> $headers['Content-type'] = 'multipart/form-data';
> $args['file'] = '@/pathtofile';
> $request = new WP_Http;
> $result = $request->request($url,$args);
>
> Let me know if you have questions

New description:

 If you submit file through wp curl it doesnt send boundary params for file
 multipart, because in class-http.php at line 174 `$r['body']` array is
 converted to string:
 {{{
 $r['body'] = http_build_query( $r['body'], null, '&' );
 }}}

 And curl wants array to send file boundary to rest api , in that case it
 fails.
 ex.
 {{{
 $headers['Content-type'] = 'multipart/form-data';
 $args['file'] = '@/pathtofile';
 $request = new WP_Http;
 $result = $request->request($url,$args);
 }}}
 Let me know if you have questions

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24156#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list