[wp-trac] [WordPress Trac] #40445: Large file upload through XML-RPC fails with error 500

WordPress Trac noreply at wordpress.org
Mon Apr 17 18:27:09 UTC 2017


#40445: Large file upload through XML-RPC fails with error 500
--------------------------+------------------------------
 Reporter:  avibrazil     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  XML-RPC       |     Version:  4.7.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by redsweater):

 Based on my experience working with the limitations of the WordPress
 XMLRPC API, I would say this issue is almost certainly based on the size
 of the image somehow overwhelming the server's PHP instance such that it
 can't handle the upload.

 To upload images via XMLRPC the client has to convert the image to base64
 and encode the entire image into a single POST request to the XMLRPC API
 endpoint. At this point the server process, in PHP, has to unwrap the
 entire XML file and handle each of the arguments separately. In the case
 of image data this means decoding from base64 back to binary data, and
 then performing whatever additional processing is necessary.

 There may be tweaks that could be done in the XMLRPC library or in
 WordPress to treat file uploads differently from other API requests, but
 this is a long-lived problem that seems unlikely to be worth addressing if
 the newer REST API handles it more efficiently.
 (https://developer.wordpress.org/rest-api/reference/media/#create-media)

 Uploads via the new REST API are handled more similarly to the way uploads
 are handled by the web-based uploads. That is: the binary data for the
 upload is POST'd directly as the content of a request to upload data. This
 should give the API the ability to more efficiently process the data and
 stream it for example to disk without imposing the same memory
 requirements on the PHP process. I suspect the new REST API is far more
 resilient to large file uploads than XMLRPC is.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40445#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list