Link to home
Start Free TrialLog in
Avatar of bhomass
bhomass

asked on

servlet download file

I am using servlet to down load different kind of files, some text, some binary. I use BufferedInputStream to read in the file content and use response.getOutputStream(  ) to write out.

I tried setting content type to "text/plain" for a text file, but FF browser simply opens it up, whereas I want to get it to activate the download dialog.

I then tried content type "application/octet-stream", I get a error message, something about
some strange filename with .lnk can not be saved, because an unknown error occurred. Try save to a different location.

is it obvious what I did wrong?

ASKER CERTIFIED SOLUTION
Avatar of Jathrek
Jathrek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bhomass
bhomass

ASKER

nice. the example I followed was just incomplete. I found references for the things you included, and the code worked!