[wp-trac] [WordPress Trac] #21292: XML-RPC: wp_upload_bits should act like wp_handle_upload (was: Using wp_handle_upload in the XML-RPC)

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 26 19:54:29 UTC 2012


#21292: XML-RPC: wp_upload_bits should act like wp_handle_upload
--------------------------------------+------------------
 Reporter:  markoheijnen              |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  3.5
Component:  XML-RPC                   |     Version:  1.5
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |
--------------------------------------+------------------

Old description:

> At this moment there isn't a check for file size when uploading an image
> through the XML-RPC. The reason is that the method wp_upload_bits is
> used. This only checks it does is if the file size is to big for a
> network installation.
>
> The function check_upload_size() is something what you want except that
> it will use wp_die() if there is an error like this. The function is used
> as a filter: wp_handle_upload_prefilter. Which only get applied in the
> function wp_handle_upload.
>
> We should change some of the functions to allow to return an error
> instead of using wp_die(). When you look into check_upload_size() this
> should get a second parameter instead of checking if there is a $_POST
> variable set.
>
> related: #6559 and #21085

New description:

 At this moment there isn't a check for file size when uploading an image
 through the XML-RPC. The reason is that the method wp_upload_bits is used.
 This only checks it does is if the file size is to big for a network
 installation.

 The function check_upload_size() is something what you want except that it
 will use wp_die() if there is an error like this. The function is used as
 a filter: wp_handle_upload_prefilter. Which only get applied in the
 function wp_handle_upload.

 We should probably change check_upload_size() a bit so it doesn't use
 wp_die() but does it somewhere else.

 related: #6559 and #21085

--

Comment (by markoheijnen):

 Added a new patch that checks if a user can upload any file.

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


More information about the wp-trac mailing list