What i need, is when the user clicks on a link to download a file it opens the standard file save as / open dialog box. The user can then choose a location to save the file and carry on.
what sort of file. if you just link to the file then it should automatically prompt this, but if its a webfile like an image or something like that then you can zip it and then just link to the zip, or even add a little note "to download right click and save as"
The file is an .mpg. At the moment if i select the link no file dialog box appears. I wondered if there was any java code or something to prompt this. Thanks for your help!
I had the same problem with a CSV file--I needed the browser to save it to the client's disk, not open it as a spreadsheet. The trick is to include this HTTP header:
Content-disposition: attachment; filename=<yourfile.mpg>;
When Internet Explorer sees this, it presents a file download dialog instead of rendering the content. It works for me with Netscape 7 too, as long as popus are enabled.
i actually need to do the exact same thing, except...
i have a button on my jsp.. let call it "Generate"....
what i would like to do is.. when the user clicks generate,
a file is generated (the jsp is displaying a spreadsheet in html, and a csv file
is generated).. once this file is generated.. i want the user to be prompted
via a pop-up box and is asked where to save this file...
In a JSP page of my site I am showing the .csv file links. When user clicks the link the file download dialog box use to appear to let the user download the file. This was working fine with IE 5.5. But user have shifted their browser version from IE5.5 to IE6.0. And now user do not see the same old download dialog box. The .csv file is getting open in the browser itself. Can anybody help me out? Because the same code was working with IE5.5 but it is not working with IE6.0. What may be the reason behind this?
I used the Below lines in my JSP page for displaying File Dialog
HI,
I have a similar problem, I tried your suggestions for "Content-disposition" but didn't change any thing.
I explain my prblem, I have a link on a jsp page normaly when you click the link you get the dialog box (open/save/cancel)
with firefox it gives the dialog box but with IE it doesn't give the dialog box all the times just for some files
,I have different files (.pdf), (.rtf), (.doc), with (.pdf)(.rtf)no problem but with (.doc) files doesn't work for all
my link is like this:
----------------------------------------
<%if(row.get("cv_id") == null){%><fmt:message key="club.field.yes_no0" bundle="$msg"/><%}
else
{%>
<a href="<%=request.getContextPath()%>/tmp/<%=row.get("filename")%>?id=<%=row.get("employee_id")%>" class="gray"><fmt:message key="club.field.yes_no1" bundle="$msg"/></a>
----------------------------------------
any ideas please.
thanks
In the JSP page put the following two lines of code inside a scriptlet to display a open/save dialog box, which helps the user to choose the location to save the file.
Bookmarks