Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File download

 
kausalya mohan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I tried the following code to download a file.
<%
String fileName = "abc.xml";
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("text/xml");
%>

But when I execute this I get the file dialog,but when I click on the open button I get "Action cancelled".But I want to download the file.Can anybody help?

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic