1

I want to use jQuery to download a list of files to my local computer, in this kind of fashion:

$download = function(){
   $("#div").find("#picture").download("C:\my_dir\");
}

I'm unsure whether or not this can be done using jQuery. I know I could load the image and allow the user to save if he wished, but can jQuery be used to automate the downloading of a bunch of files?

user3478799
  • 55
  • 1
  • 1
  • 6
  • JavaScript can NOT access a computers file system. – Sterling Archer Mar 30 '14 at 18:41
  • 1
    @RUJordan that's not entirely true. html5 does have a [file API](http://www.w3.org/TR/file-upload/) though it doesn't currently support (and I doubt it ever will) completely automating saving of files – CrayonViolent Mar 30 '14 at 18:49

1 Answers1

0

Javascript cannot access the filesystem. What you can do, as a workaround is to have a form submit and that the target of the form serve up the file you're trying to download. That also works quite well if the file to be downloaded depends on the content of the form.

Ashesh
  • 2,978
  • 4
  • 27
  • 47