#6559 closed enhancement (duplicate)
The information on the file posted by xmlrpc cannot be changed by wp_handle_upload.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | XML-RPC | Version: | 2.5 |
| Severity: | normal | Keywords: | |
| Cc: | josephscott |
Description
- The part corrected by #3395 is overwritten.
The wp_handle_uplaod filter cannot access the uploaded file.
- apply_filters() is called after wp_insert_attachment().
Even if wp_handle_upload rewrites an information, it is recorded on the database for the information before a modification.
Attachments (1)
Change History (9)
comment:1
follow-up:
↓ 3
josephscott
— 5 years ago
- Cc josephscott added
I'm not sure I follow, isn't the current XML-RPC behavior the same as uploading a file via wp-admin? See wp_handle_upload( ) in wp-admin/includes/file.php.
Hmmm, I'm tempted to say that we should be using wp_handle_upload( ) in XML-RPC.
comment:3
in reply to:
↑ 1
jyoshida
— 5 years ago
Replying to josephscott:
I'm not sure I follow, isn't the current XML-RPC behavior the same as uploading a file via wp-admin? See wp_handle_upload( ) in wp-admin/includes/file.php.
No, it is different.
For example, in wp-admin/include/media.php media_handle_upload(), wp_handle_upload() is called before wp_insert_attachment().
I think that meida_handle_upload() is used from a dashboard when an image file is uploaded. The wp_handle_uplaod filter can access the uploaded file and can also perform the updation of file information.
Hmmm, I'm tempted to say that we should be using wp_handle_upload( ) in XML-RPC.
I think that a good idea replaces apply_filters() by wp_handle_uplaod().
comment:4
josephscott
— 5 years ago
In general I think it is best to push filters/hooks/etc. down further into WordPress than to have them higher up in the XML-RPC code. This tends to reduce unnecessary code duplication.
Can you put together a patch that makes use of the wp_handle_upload( ) function instead?
comment:5
jyoshida
— 5 years ago
It was tried. But it failed. wp_handle_upload() was made so that a file might be received by $_FILES. It seems that the file made from wp_upload_bit() cannot be handled.
comment:6
Denis-de-Bernardy
— 4 years ago
- Keywords needs-patch added
- Milestone changed from 2.9 to Future Release
- Type changed from defect (bug) to enhancement
comment:7
markoheijnen
— 11 months ago
- Resolution set to duplicate
- Status changed from new to closed
Closed as duplicate in favor of #21292
comment:8
markoheijnen
— 11 months ago
- Keywords needs-patch removed
- Milestone Future Release deleted
The patch to xmlrpc