Select directory for HTML5 multiple file input in Firefox?
Asked Answered
G

2

11

I want to allow users to select a local directory on a webpage (and then read all the files in the directory).

In Chrome I can add the webkitdirectory attribute to enable this functionality. According to a comment in this question and an answer to this question you should be able to do the same in firefox using mozdirectory but I am unable to get it to work.

I have tried the following in Firefox with no luck (works in Chrome):

 <input type="file" id="files" name="files[]" multiple mozdirectory="" webkitdirectory="" directory="" />

My Firefox version is 10.0.

Are there any way for a user to select a directory for input in Firefox without requiring an add-on on the client-side (like Flash)?

Geniality answered 1/3, 2012 at 14:51 Comment(2)
I think mozdirectory is a mythBelleslettres
Its possible now! See my answer: https://mcmap.net/q/205691/-html5-drag-and-drop-folder-detection-in-firefox-is-it-even-possibleSymonds
O
9

Firefox doesn't have any API to upload directories yet (which is a shame)...not even in the nightly builds, so I don't think we will see support on this very soon. IE doesn't have one either. If you want to take advantage of this feature you must force the users to use Google Chrome (e.g. make them aware that upload directory is available only in Chrome).

A workaround would be to compress the directory in a .zip file and read it with the FileReader API. See https://mcmap.net/q/206342/-javascript-fileapi-iterating-directories

Update
IE Edge now has support for this.
https://msdn.microsoft.com/en-us/library/mt574730(v=vs.85).aspx

Ouachita answered 19/3, 2012 at 13:44 Comment(0)
E
-3

Now you can upload directory using drag and drop with chrome

read this article you will get more info

http://updates.html5rocks.com/2012/07/Drag-and-drop-a-folder-onto-Chrome-now-available

Etem answered 24/7, 2012 at 12:20 Comment(1)
This does not answer the question.Fail

© 2022 - 2024 — McMap. All rights reserved.