6

I'm using the webkitdirectory attribute on my page for allow the user to upload a whole directory:

<input webkitdirectory type="file" />

This works great for Chrome, Firefox and Edge, but is unsupported for Internet Explorer. Is there a alternative in order to support IE?

Dylan
  • 697
  • 1
  • 9
  • 27
  • I don't know if this may help, but you can check [this](http://stackoverflow.com/questions/23104990/chrome-folder-upload-api-detect-support-workaround-with-js-jquery) out. – Carl Binalla Mar 01 '17 at 05:09
  • 1
    its not officially supported in IE [See Here](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory) – Sajjad Hossain Sagor Mar 07 '17 at 16:53

3 Answers3

2

No, there will be no alternative if the browser itself does not support, as this is related to file system which javascript in webpage cannot reach.

One alternative is to use the multiple attribute to upload multiple files (reference), but this still is only supported in IE10, and it won't keep the directory structure.

cytsunny
  • 4,838
  • 15
  • 62
  • 129
2

Note these double meaning word from MSDN

For compatibility purposes, Microsoft Edge supports the webkitdirectory attribute.

Which says that only Edge supports webkitdirectory attribute

See the link below to read about IE's input support

https://msdn.microsoft.com/en-us/library/ms535263(v=vs.85).aspx

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
Sagar V
  • 12,158
  • 7
  • 41
  • 68
0

As you said, the functionality is not supported in IE and therefore you can't use it. I tried finding a polyfill for it but without success.

After reading

Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

In the MDN website I wouldn't recommend you using this specific feature if you're developing anything but a test site for yourself.

Obed Parlapiano
  • 3,226
  • 3
  • 21
  • 39