Setting File Name in response
843841Jan 30 2004 — edited Oct 30 2008Hi,
On server side I read the (Pdf) file and then stream the file content thru response object so that this pdf file opens in browser using Adobe reader. This works just fine.
And right now, if user wants to save this file in browser, complete jsp url appears as file name in save as dialog box.
For eg.:
If my jsp has stream the pdf file from this url
http://www.xy.com/jsp/displayFileJsp?f=xyz.pdf
then
when user tries to save this file, browser save as dialog displays file name as "http://www.xy.com/jsp/displayFileJsp?f=xyz.pdf"
But I want user should download that file name with specific file name like xyz.pdf.
I tried to set the content type
response.setHeader("Content-Disposition", " filename=xyz.pdf" );
But it didn't work.
any suggestions ?
rk