File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Trying to download File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trying to download File " Watch "Trying to download File " New topic

Trying to download File

Vrunda Joshi
Ranch Hand

Joined: Dec 03, 2001
Posts: 104

I am trying to download a file stored in Database(in a blob).I am just reading it and writing output to outputstream.

I am setting contenttype to "application/ms-word","application/" depending upon the file extension. I am also setting the response header as ""Content-Disposition"," inline; filename=" + FileName

all this together is working perfectly on my xp based laptop. as soon as I moved it to my linux based server,It has stopped functioning. The pop-up for file open/save is not coming.The servlet just shows a blank page,no error at all. I don't know how to fix and what to do..

Thanks in advance, and sorry for the lengthy post...
Vrunda Joshi
Ranch Hand

Joined: Dec 03, 2001
Posts: 104
Problem Fixed!!! I checked the other topics related to "File Download" and changed my response header from
"Content-Disposition"," inline; filename=" + FileName
"Content-Disposition"," attachment; filename=" + strFileName

and it's working now

I wish I had done this before posting reply...
thanks anyways,
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Thank you for posting back with your solution.
Now this thread can someone else using the search tool.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Trying to download File
It's not a secret anymore!