[wp-trac] [WordPress Trac] #21497: Make uploads on XML-RPC resumable

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 6 20:06:06 UTC 2012


#21497: Make uploads on XML-RPC resumable
-------------------------+------------------------------
 Reporter:  pento        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  XML-RPC      |     Version:
 Severity:  minor        |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by pento):

 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21497#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list