5

Is it possible to upload a whole folder instead of multiple files using Javascript? If so, what is the approach. If there is no straighforward approach, is there any workaround to achieve the same? I have always been curious about this topic. Any insights will help.

Andreas Bonini
  • 44,018
  • 30
  • 122
  • 156
oninea
  • 1,423
  • 4
  • 14
  • 15
  • 1
    possible duplicate of [What is the best way to upload a folder to a website?](http://stackoverflow.com/questions/254251/what-is-the-best-way-to-upload-a-folder-to-a-website) – Liam Mar 06 '14 at 15:08

4 Answers4

2

EDIT

Turns out this is supported in Chrome 11, and seems to also work on Firefox if you use a vendor prefix: https://stackoverflow.com/a/5849341/486547


This is definitely possible with a Java applet, however the % of folks with a JRE installed has gotten pretty low these days (< 70%)

Google Drive does this (choose upload, then "Folder..") It works for me (Mac OS X 10.7.5 in Chrome).

I'm not entirely sure how yet. I'm working on a project where this matters, so I've been looking for a while. I'll update as soon as I have more.

Sounds like you're already aware of this, but in the mean time, you can use valums or blueimp to do multiple file upload.

Community
  • 1
  • 1
mikermcneil
  • 11,141
  • 5
  • 43
  • 70
2

No you can't, except if its zipped, or you can use flash, silverlight or applet for uploading more than one file in the same time.

Check these questions: multiple file upload in just single browse click without jquery

Multiple File Selection For Uploading in ASP.NET

Edit:
For sure uploading multiple files at the same time is available now using html5 https://stackoverflow.com/search?q=multiple+file+upload+html5

Community
  • 1
  • 1
Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301
  • Took a look at SWFUpload. It's as close as it gets to what I had in mind. Thanks for the push Pekka. – oninea Dec 16 '09 at 15:11
0

There is no way to do this in most browsers in javascript. Obviously though some (naive) browsers may have this functionality, as the javascript API is defined by the browser itself.

It may be possible using other technologies (such as silverlight, flash, etc) as mentioned in the other answers.

Andreas Bonini
  • 44,018
  • 30
  • 122
  • 156
-4

Of course there is. It opens a large security hole, but you can always use WScript and Filesystem ActiveX objects to access OS file system and transfer as many files as you like

alemjerus
  • 8,023
  • 3
  • 32
  • 40
  • If by "always" you mean "not in most browsers or operating systems"... :-) – ceejayoz Dec 16 '09 at 14:55
  • This is a bad solution, because it relies on an extremely small subset of browser platforms : Works only on an Internet Explorer running on a Windows machine. At a time when everything including smartphone contains browsers, you should go for a more generic solutions. A combination which feature both A. classic file-per-file upload and B. some plug-in as suggested by the 2 other posts (Java, Flash, etc.) should be versatile enough, while being user friendly in most cases. Facebook photo-upload works that way (HTML+Java) (But keep in mind that even things as popular as iPhones lack Flash). – DrYak Dec 16 '09 at 15:10
  • So DrYak, if you wanna reach a wider browser audience, is html/javascript still the way to go? Asking this because I wanna port my website to run in Japanese phone browsers. – oninea Dec 16 '09 at 15:14