1

In my java web application need to copy 6 files from server to user machine usb drive on clicking of save files button.

If usb drive not found than need to show warning message 'no usb drive detected'.

I think, Due to security issue it is not possible through Java script.

What will be the correct solution?

thaya
  • 15
  • 2
  • 1
    What have you tried so far? Do you have [mcve](http://stackoverflow.com/help/mcve)? – Andrey Nov 15 '16 at 13:23
  • You want to download files from a web server when they click a button, bypassing the browser's normal download procedure, then write the files directly to a media device on the user's computer... from a web browser? I'd take a guess that will be impossible, due to security concerns. Just download the files like normal and force the user to pick the save location. – samiles Nov 15 '16 at 14:28

1 Answers1

1

As a web site, you can't tell the user where he should save the files, on the other side, you can create a script that downloads the files in the place the script is. If you are on Windows:

  1. Get the "wget for windows" binary and put it on the USB key.
  2. Create a get_server_file.bat script file.
  3. Edit the file and but commands lines like

    wget http://example.com/yourfile.txt

When the user clicks on the script, the files will be downloaded. If you need more options, look at the wget documentation.

Orden
  • 589
  • 3
  • 13