Hi From the remote location, i want to download a file using JSP. how to do it ??? Thanks, Yegappan
Joined: Dec 15, 2001
The easiest method is to read the file using FileInputStream from the server, change its content type to 'application/octet-stream' and append it to the ServeltResponse. The browser will pop up the download window and the user can save the file to his harddisk.
--: Biju Nair :--
Joined: May 21, 2001
Originally posted by Biju Nair: The easiest method is to read the file using FileInputStream from the server, change its content type to 'application/octet-stream' and append it to the ServeltResponse. The browser will pop up the download window and the user can save the file to his harddisk.
I wouldn't say that's the EASIEST way but it is probably the best way. Depending on the type of file, you can use http headers and the mime type to download the file. For instance, if you are downloading a comma separated value (csv) file, you set the mime type to text/csv and then just redirect the browser to the file. Depending on how the browser's mime types are set up, you might get a download dialog box or it might just load the file in the browser. The point is, doing it this way is browser (client) specific and that may not be what you want. However, there is a lot of flexibility in using mime types and you may be able to achieve the effect you are looking for very easily.
Joined: Jan 04, 2002
There is a package specifically done for uploading a file and downloading in oreilly's site Use Multipart request classes for doing your stuff Download the package from www.oreilly.com [ January 04, 2002: Message edited by: hkg ]
Joined: Jul 25, 2001
Hello Find For in google JSP SMARD loader download it this u can implement for uploading files from a remote PC sandeep balyan
Hello Friends, I wanted a help in downloading files. I am actually using Jspsmartupload for downloading. It is working fine. However the probelem is that everytime I click for the file to be downloaded ,rather than showing a pop up window it straight away shows the content in the browser. This is true for the generally understood files like .jpeg, .doc,.txt. Only when I give a not so common file extension will then the pop up window come and ask if I want to save the file ...
Hence how do I ensure that irrespective of the type of file , a window always pops up asking if I want to save the file .... I guess it might be something to do with the mime type , so please remember that I am using Jspsmartupload. Thanks in advance, Regards, Milan Doshi