-1

I want to invoke the file save as prompt while allowing the user to download a file in ExtJS from a URL. Basically the idea is to allow the user to change the file name and select his desired location before saving the file on their machine.

Is there any way I could do this?

I do not want to use:

  1. A server side code to send the headers.
  2. Nor do I want to use the Flash-based Downloadify library to do this.
  3. Also, <a> tag's "download" attribute does download the file, but it does not prompt the dialog box if the browser settings are not set right.

Is there any way apart from the above where we could handle the file download in our application?

sherb
  • 5,845
  • 5
  • 35
  • 45

1 Answers1

0

No, it cannot be done with javascript alone due to the security restrictions of the contemporary browsers. You can read files but I have no knowledge of a way to save files directly from the javascript alone.

If your "I do not want tos" are not that strict, here you can find an example of file downloading. The essence is to send "Content-Disposition: attachment" header.

Saki
  • 5,827
  • 2
  • 15
  • 15