Make WordPress Core

Opened 17 years ago

Closed 13 years ago

Last modified 13 years ago

#6559 closed enhancement (duplicate)

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

Reported by: jyoshida's profile 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 17 years ago.
The patch to xmlrpc

Download all attachments as: .zip

Change History (9)

@jyoshida
17 years ago

The patch to xmlrpc

#1 follow-up: @josephscott
17 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.

#2 @Nazgul
17 years ago

  • Milestone set to 2.6

#3 in reply to: ↑ 1 @jyoshida
17 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().

#4 @josephscott
17 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?

#5 @jyoshida
17 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.

#6 @Denis-de-Bernardy
16 years ago

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

#7 @markoheijnen
13 years ago

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

Closed as duplicate in favor of #21292

#8 @markoheijnen
13 years ago

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