[webkit-dev] Directory upload experimental feature
ddkilzer at webkit.org
Wed Jun 2 03:44:12 PDT 2010
> Other alternatives?
I believe Safari will zip a folder and send it as a single file for you if you attach a folder to a file upload element instead of an individual file.
From: John Gregg <johnnyg at google.com>
To: Sam Weinig <sam.weinig at gmail.com>
Cc: webkit-dev at lists.webkit.org
Sent: Tue, June 1, 2010 3:09:00 PM
Subject: Re: [webkit-dev] Directory upload experimental feature
My proposal for that is that all the files would be listed in the form submission the same way as if it were a <input type="file" multiple>, but in the Content-Disposition header, the filename component would contain the path information.
One alternative idea would be add a "path" component to the Content-Disposition header alongside the filename which remains unchanged, but I think that would be a much more difficult approach. Other alternatives?
If you are have these files
and choose "photos" from the directory picker, you'd end up with
input.files.name = "1.jpeg"
input.files.path = "photos/vacation/1.jpeg"
input.files.name = "2.jpeg"
input.files.path = "photos/vacation/2.jpeg"
input.files.name = "1.jpeg"
input.files.path = "photos/conference/1.jpeg"
Your POST would look like
Content-type: multipart/form-data; boundary=----WebKitFormBoundaryFoo
Content-Disposition: form-data; name="input"; filename="photos/vacation/1.jpeg"
Content-Disposition: form-data; name="input"; filename="photos/vacation/2.jpeg"
Content-Disposition: form-data; name="input"; filename="photos/conference/1.jpeg"
On Sat, May 29, 2010 at 10:22 AM, Sam Weinig <sam.weinig at gmail.com> wrote:
How will the directory structure and all the files therein be represented in the form submission?
>On Fri, May 28, 2010 at 3:17 PM, John Gregg <johnnyg at google.com> wrote:
>>I recently proposed adding directory upload support to HTML via a new <input> attribute to whatwg@, and the discussion arrived at "try it out". Having written some code I think I have something that works pretty well, and I'd like to land it on an experimental basis in WebKit, but want to reach out early before trying to put any code in the tree. The plan that comes to mind is a new ENABLE_DIRECTORY_UPLOAD flag, but I'm completely open to other options.
>>Background (cf. the whatwg thread http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-April/025764.html):
>> - The use case for this is a photo album or file manager web application, which wants the user to easily choose an entire directory to recursively upload, while preserving the sub-directory structure.
>> - The reason for the new attribute is to signal the UA to show a native folder-picker rather than a file-picker, which on most OSs are two distinct dialogs.
>>The approach I'm using has 2 parts and is a small amount of WebCore code (about 200 lines).
>> - Extend HTMLInputElement to support the directory attribute, which is passed up via FileChooser allowing the UA to display a folder-picker. UA enumerates all the files and returns them in the normal way.
>> - Extend File to have a File.path property, which contains the path information starting from the chosen directory as the root. HTMLInputElement is responsible for generating these values from the list of files when the directory attribute is set.
>>>>webkit-dev mailing list
>>webkit-dev at lists.webkit.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev