Opened 10 months ago
Last modified 2 weeks ago
#21292 assigned defect (bug)
XML-RPC: wp_upload_bits should act like wp_handle_upload — at Version 7
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | XML-RPC | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch 3.7-early |
| Cc: | ercoli@…, Viper007Bond, lol@… |
Description (last modified by markoheijnen)
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.
Change History (9)
comment:1
markoheijnen — 10 months ago
- Description modified (diff)
comment:2
SergeyBiryukov — 10 months ago
comment:3
daniloercoli — 10 months ago
- Cc ercoli@… added
comment:4
markoheijnen — 10 months ago
Finding a way to add https://github.com/daniloercoli/WordPress-streaming-xml-rpc in the new media method. And when it works well in 3.5 also add it in 3.6 for the current one.
comment:5
markoheijnen — 10 months ago
Just a weird thought. Would it make sense to fake a $_FILES array to pass through wp_handle_upload(). By using the code of Danilo to store the image localy that would make sense.
Other solution is not using it and fix wp_upload_bits(). Looking again to it and they should both do the same thing. The only difference is the input and how to act on that.
markoheijnen — 10 months ago
comment:6
markoheijnen — 10 months ago
Uploaded my first try to fix the upload limit
comment:7
markoheijnen — 10 months ago
- Description modified (diff)
- Summary changed from Using wp_handle_upload in the XML-RPC to XML-RPC: wp_upload_bits should act like wp_handle_upload
Added a new patch that checks if a user can upload any file.

Related: #20057