Link to home
Start Free TrialLog in
Avatar of aka_damo
aka_damo

asked on

Download Link

Hey,
I've a website that creates files dynamically from a database and then creates a link to the created file so that someone can click on the link to download the file. The file I'm making is a .csv file and it's created fine. The problem is that when someone clicks on the link it just opens the file in the browser. I want to be able to get the usual popup of opening the file (using excel) or saving it,
help badly needed

aka_damo
Avatar of Mick Barry
Mick Barry
Flag of Australia image

what content type are you using?
should be something like: application/vnd.ms-excel
Avatar of aka_damo
aka_damo

ASKER

objects,
All I have is a jsp page with the following

Click <a href="report.csv">HERE</a> to Download Report

report.csv is stored in the root directory of the application
try:

<a href="report.csv" type="application/vnd.ms-excel">HERE</a>
well from a href.. its really not in your hands.... its in the browser's hand how he wants to handle a particular type of file.
You might try to make fool of the browser by doing
<a href="report.csv" type="application/octent-stream>HERE</a>
or
<a href="report.csv" type="application/downloadit>HERE</a>

and see if browser likes it...
Tried that, still not working. Just doing the same thing as before
May be dependant on the browser settings, ie. how it is configured to handle csv files.
I've tried it for every type of file but it's still not working. I tried it for .xls files that I created with excel and It still won't work
okay rename your file to be as report.tst... and see what it does
Did that, tried .tst and .txt, both give me the same result. If i try and open a proper excel file the browser just prints out the binary junk that notepad would show
ASKER CERTIFIED SOLUTION
Avatar of liamgannon
liamgannon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial