My proposal for that is that all the files would be listed in the form submission the same way as if it were a &lt;input type=&quot;file&quot; multiple&gt;, but in the Content-Disposition header, the filename component would contain the path information. <div>
<br></div><div>One alternative idea would be add a &quot;path&quot; 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?</div>
<div><br></div><div><div>Example follows.</div><div><br></div><div> -John<br><div><br></div><div>If you are have these files</div><div>/home/John/photos/vacation/1.jpeg</div><div>/home/John/photos/vacation/2.jpeg</div><div>
/home/John/photos/conference/1.jpeg</div><div><br></div><div>and choose &quot;photos&quot; from the directory picker, you&#39;d end up with</div><div>input.files[0].name = &quot;1.jpeg&quot;</div><div>input.files[0].path = &quot;photos/vacation/1.jpeg&quot;</div>
<div><div>input.files[1].name = &quot;2.jpeg&quot;</div><div>input.files[1].path = &quot;photos/vacation/2.jpeg&quot;</div></div><div><div>input.files[2].name = &quot;1.jpeg&quot;</div><div>input.files[2].path = &quot;photos/conference/1.jpeg&quot;</div>
</div><div><br></div><div>Your POST would look like</div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Content-type: multipart/form-data; boundary=----WebKitFormBoundaryFoo</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div><br></div><div>----WebKitFormBoundaryFoo</div><div>Content-Disposition: form-data; name=&quot;<span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; ">input</span>&quot;; filename=&quot;photos/vacation/1.jpeg&quot;</div>
<div>Content-Type: image/jpeg</div><div><br></div><div>&lt;contents&gt;</div><div><br></div><div><div><div>----WebKitFormBoundaryFoo</div><div>Content-Disposition: form-data; name=&quot;<span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; ">input</span>&quot;; filename=&quot;photos/vacation/2.jpeg&quot;</div>
<div>Content-Type: image/jpeg</div><div><br></div><div>&lt;contents&gt;</div></div></div><div><br></div><div><div>----WebKitFormBoundaryFoo</div><div>Content-Disposition: form-data; name=&quot;<span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; ">input</span>&quot;; filename=&quot;photos/conference/1.jpeg&quot;</div>
<div>Content-Type: image/jpeg</div><div><br></div><div>&lt;contents&gt;</div></div><div><br></div></span></div><div><br><div class="gmail_quote">On Sat, May 29, 2010 at 10:22 AM, Sam Weinig <span dir="ltr">&lt;<a href="mailto:sam.weinig@gmail.com">sam.weinig@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">How will the directory structure and all the files therein be represented in the form submission?<br><br><div>-Sam</div>
<div><br><div class="gmail_quote"><div><div></div><div class="h5">On Fri, May 28, 2010 at 3:17 PM, John Gregg <span dir="ltr">&lt;<a href="mailto:johnnyg@google.com" target="_blank">johnnyg@google.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">Hi WebKit,<div><br></div><div>I recently proposed adding directory upload support to HTML via a new &lt;input&gt; attribute to whatwg@, and the discussion arrived at &quot;try it out&quot;.  Having written some code I think I have something that works pretty well, and I&#39;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&#39;m completely open to other options.</div>




<div><br></div><div>Background (cf. the whatwg thread <a href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-April/025764.html" target="_blank">http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-April/025764.html</a>): </div>



<div> - 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.</div><div> - 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.</div>



<div> </div><div>The approach I&#39;m using has 2 parts and is a small amount of WebCore code (about 200 lines).</div><div> - 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.</div>




<div> - 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.</div>



<div><br></div><div>Thoughts? </div><div><br></div><div>Thanks, </div><div> -John</div><font color="#888888"><div><br></div><div><br></div>
</font><br></div></div>_______________________________________________<br>
webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org" target="_blank">webkit-dev@lists.webkit.org</a><br>
<a href="http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev" target="_blank">http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div>