Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

downloading .csv file

Status
Not open for further replies.

oops4me

Programmer
Jul 7, 2003
50
IN
hi,

i want to download .csv for that i have written a code in in .html file as follows
<a href="files/test.csv">test</a>. when i open this html file in browser and click on that link(test), then it opening that file in browser in MS-excel format, instead of giving me dowload file dialog box.With the help of that dialogbox i can download that file. can any one give me the code.with the help of that i can download that file & not opening in browser.
 
What happens when a user clicks on that link will depend on their own browser settings and as such there is no way to control it through your HTML code.

What you could do is put a guidance note next to the link something like "To download, right-click and select Save Target As...".

--James
 
You cannot decide for yourself or have some code for downloading files. When you click on a file, your browsers looks at the list of files it can handle or knows external application that can. If something on your computer can handle the mime file type you are downloading, chances are browser will launch that program to open the file. You can set up mime types in browser's preferences but that is different for every browser, will work only on browsers you set it manually and has nothing to do with html.

On the other hand, it is the server's job to tell the browser what kind of file it is. If you have some sort of server-side scripting available, you can serve the file as an unknown type and your browser will prompt you to download the file. But once again, that solution has nothing to do with html but rather with whatever server or server-side technology you are using.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top