[wp-trac] [WordPress Trac] #38560: Add support for uploading arrayed $_FILES (was: media_handle_upload() can't handle arrayed $_FILES)

WordPress Trac noreply at wordpress.org
Thu Aug 10 17:33:06 UTC 2017


#38560: Add support for uploading arrayed $_FILES
------------------------------------------+-----------------------------
 Reporter:  kontur                        |       Owner:
     Type:  feature request               |      Status:  new
 Priority:  normal                        |   Milestone:  Future Release
Component:  Media                         |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------------
Changes (by joemcgill):

 * keywords:   => needs-patch needs-unit-tests
 * type:  enhancement => feature request
 * milestone:  Awaiting Review => Future Release


Comment:

 Hi @kontur,

 Thanks for the ticket.

 The `media_handle_upload` function is meant to handle a single file at a
 time, from which it will generate and return a single attachment. If
 you're writing custom code, I would suggest handling the `$_FILES` object
 yourself, as you are suggesting.

 See examples: https://wordpress.stackexchange.com/questions/173197/upload-
 multiple-files-with-media-handle-upload

 If we want to support this in WordPress core, we should add handling for
 multiple file outside `media_handle_upload`, in places like
 `wp_ajax_upload_attachment` and
 `WP_REST_Attachments_Controller->upload_from_file()`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38560#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list