On 11/3/06, Balwinder <[EMAIL PROTECTED]> wrote:
Hi All,

I am developing an application in struts in which I needed to download a
file from a server.  When iam clicking on download button, file lose its
extension and it with the action ie .do and does not open with the
associated application.

Any help is highly appreciated.

Should be a case of setting the content type and disposition properly:

For example, for a pdf file:
       response.setContentType("application/pdf");

Then, if you want it to open in the browser, with assoc application:
       response.setHeader("Content-disposition", "inline; filename="
+ fileName);

If you want to save it to disk
       response.setHeader("Content-disposition", "attachment;
filename=" + fileName);

From memory I also had to play with the headers that say "don't cache"

Niall

Thanks in advance.

Thanks and Regards,
Balwinder Kumar

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to