troubleshooting Question

how to force download of file from website

Avatar of Mark
Mark asked on
4 Comments1 Solution458 ViewsLast Modified:
I am trying to create a jsp program to force the "download" dialog, not open the file in the user's browser. I'm having trouble. I have the following code, but it opens the file in the browser anyway. The file is just an Automated Clearing House transaction file which the user has to save to a special location, so there is little sense (an preferable NOT) to see the file contents. What can I do?

<%@page trimDirectiveWhitespaces="true"%>
    response.setHeader("Content-disposition", "attachment; filename=ACH.txt");

%><%@ page import="*"%>
out.println("101 .... etc\r);
out.println(" .... ");
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros