File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes how to download a file....... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to download a file......." Watch "how to download a file......." New topic
Author

how to download a file.......

Yegappan Balasubramanian
Greenhorn

Joined: Nov 19, 2001
Posts: 13
Hi
From the remote location, i want to download a file using JSP.
how to do it ???
Thanks,
Yegappan
Biju Nair
Ranch Hand

Joined: Dec 15, 2001
Posts: 31
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:--


--: Biju Nair :--
Jason Kilgrow
Ranch Hand

Joined: May 21, 2001
Posts: 47
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.
hkg
Greenhorn

Joined: Jan 04, 2002
Posts: 5
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 ]
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hello
Find For in google JSP SMARD loader download it this u can implement for uploading files from a remote PC
sandeep balyan


Want to do something great will do one day
Mouse Slider
Greenhorn

Joined: Nov 02, 2001
Posts: 4
Originally posted by sandeep balyan:
JSP SMARD

"jspSmartUpload", which you could find on
www.jspsmart.com
Doshi Milan
Ranch Hand

Joined: May 29, 2001
Posts: 112
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to download a file.......