Make WordPress Core

Opened 12 years ago

Closed 8 years ago

#21497 closed enhancement (wontfix)

Make uploads on XML-RPC resumable

Reported by: pento's profile pento Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: XML-RPC Keywords:
Focuses: Cc:


In order to play nicely with unreliable internet connections (ie, mobile, conference wifi) it would be nice to be able to resume uploads over the XML-RPC API.

Attachments (3)

resumable-upload.diff (4.5 KB) - added by pento 12 years ago.
resumable-test.php (1.8 KB) - added by pento 12 years ago.
resumable-upload.2.diff (5.1 KB) - added by pento 12 years ago.

Download all attachments as: .zip

Change History (11)

12 years ago

#1 @pento
12 years ago

Example usage of the tester:

php resumable-test.php -u test -p test -f ~/Pictures/P1120772.JPG -h http://localhost/wordpress/xmlrpc.php -s 2097152

#2 @pento
12 years ago

The new patch tidies up the code a bit, and removes some unnecessary checks and error messages.

To give an overview of what this patch does, it adds 5 new parameters to the data struct:

  • resume: flags if this is a resumable upload or not.
  • filesize: the intended size of the file being uploaded.
  • path: the path on the server that the file is being uploaded to. This is required for the second chunk onwards.
  • location: the byte location in the file that the current chunk is being written to. At the moment, the code only supports appending to the file, so the only valid location is at the end, but it could be modified to write to anywhere in the file.
  • url: The public url of the uploaded file, as returned by wp_upload_bits(). This is required for the final chunk, when it's given to wp_insert_attachment().

While the upload is incomplete, the return struct has a path element, instead of an id element, used to identify the file being uploaded.

A few things that I haven't decided yet:

  • I'm not sure that path is the correct unique identifier to use, as it could be a security problem. Writing to /tmp isn't really an option, it won't work on cluster setups.
  • How to handle the potential to overwrite another site's files in MS.
  • If we should be pre-allocating the entire space in the wp_upload_bits() call, so it can do sanity checking on the file size immediately.

#3 @pento
10 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The world turns;
new technologies arise.
XML-RPC is no more;
JSON is the way of the future.

#4 @markoheijnen
10 years ago

  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Unsure if we should close this ticket tho. XML-RPC is something we need to use for at least another year if not more.
Also this issue still we be there for JSON and it will not be included in 4.1. So we still need to wait.

We could change the focus of the patch and build something outside the XML-RPC so the JSON REST API can also benefit from it.

#5 @pento
10 years ago

There are certainly ways to do this so that the JSON REST API could benefit. wp-admin could use it, too, with the Blob.slice() method.

I think the idea is worth experimenting with, but I'm not entirely convinced it's good for core - it seems that it would add a large amount of complexity to file handling, for a moderate benefit.

#6 @dd32
10 years ago

There have been talks in the past about utilising Plupload's Chunking feature to work around hosts with small upload limits.

It'd certainly be welcome for large Theme / Plugin uploads too (Which don't use Plupload at present, but that's a different story).

Complexity is a worry, but realistically it seems like something that could be worked around on most systems:

  • Store uploaded chunks in temporary file that gets appended to
  • Only pass the file into core api's & filters once all the file is uploaded, unless someone explicitly asks for it, they never see the chunked request components.

#7 @chriscct7
8 years ago

  • Keywords needs-patch added
  • Severity changed from minor to normal

#8 @pento
8 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

This was a cute idea, but it's not going to happen.

Note: See TracTickets for help on using tickets.