WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 21 months ago

Last modified 21 months ago

#6559 closed enhancement (duplicate)

The information on the file posted by xmlrpc cannot be changed by wp_handle_upload.

Reported by: jyoshida Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: XML-RPC Keywords:
Focuses: Cc:

Description

  1. The part corrected by #3395 is overwritten.

The wp_handle_uplaod filter cannot access the uploaded file.

  1. 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)

xmlrpc.patch (1.4 KB) - added by jyoshida 6 years ago.
The patch to xmlrpc

Download all attachments as: .zip

Change History (9)

jyoshida6 years ago

The patch to xmlrpc

comment:1 follow-up: josephscott6 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:2 Nazgul6 years ago

  • Milestone set to 2.6

comment:3 in reply to: ↑ 1 jyoshida6 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 josephscott6 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 jyoshida6 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-Bernardy5 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.9 to Future Release
  • Type changed from defect (bug) to enhancement

comment:7 markoheijnen21 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

Closed as duplicate in favor of #21292

comment:8 markoheijnen21 months ago

  • Keywords needs-patch removed
  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.