WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 5 months ago

#39553 new enhancement

Use REST API endpoints for Plupload backend

Reported by: rmccue Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Media Keywords: has-patch
Focuses: rest-api Cc:

Description

async-upload.php currently handles all our backend uploading needs. However, with the new POST /wp/v2/media endpoint in the REST API, we no longer need a specialised API.

I had a quick (30 min) go at converting this, and it actually worked out pretty well, which is crazy. There are sure to be a tonne of backwards compatibility concerns to tackle here (especially around the custom parameters that can be passed along), but I'm confident we can tackle them.

Working proof-of-concept patch attached. This changes both the Media Library uploader (wp-plupload.js) and media-new.php (media_upload_form/plupload/handlers.js).

Attachments (1)

39553.diff (6.4 KB) - added by rmccue 11 months ago.
Early POC at conversion

Download all attachments as: .zip

Change History (13)

@rmccue
11 months ago

Early POC at conversion

#1 @dd32
11 months ago

It'd be great if we could enable the Plupload chunking of larger files at the same time here - I know that dramatically increases the amount of work, but would be a welcome addition by many, and would be a good enough reason to break some of the BC concerns in the API IMHO.

#2 @rmccue
11 months ago

Chunking could work, but we need to work out how that looks in a REST context. (That is, design the endpoint first, then make Plupload work with it.) My concern would be that it's a use case that only the admin can use, which wouldn't be great, but if we can design it in an admin-agnostic way, I'm all for adding it.

#3 @rmccue
11 months ago

For reference, S3's API has multi-part support, however this is run a little differently.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


10 months ago

This ticket was mentioned in Slack in #core-media by rmccue. View the logs.


10 months ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


8 months ago

This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.


8 months ago

#8 @rmccue
8 months ago

Split the chunked upload enhancement out to #40410; we should do it, but it shouldn't hold up the JS changes, which lay the groundwork for adding this later.

This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.


7 months ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


7 months ago

#11 @joemcgill
7 months ago

  • Milestone changed from 4.8 to Future Release

Punting based on feedback from @rmccue.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


5 months ago

Note: See TracTickets for help on using tickets.