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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Download

Status
Not open for further replies.

flanakin

Programmer
Mar 21, 2000
158
US
I have a .TXT file that I need to force download on. When I say "force" download, I mean, do not display it. Currently, the browser is simply displaying the contents. I renamed the extension to .FAC, thinking that the browser would not recognize the MIME type and auto-download, but to no avail.

If someone could let me know how to force download [over display] of an ASCII file, please let me know. Thanks in advance. ~[ cid ]~
cid@ciddivine.com
 
If you compress your .txt file into a .zip file, the browser will automatically force a download when the user clicks on the link.
 
or if you don't want a link, but to really start downloading when the page loads, add something like this to your page:

<body>
..
...
<script>
location.href=&quot;filename.zip&quot; // it's better be zip, because txt will just open the text file
</script>
...
..
</body> ---
---
 
I don't want it to be a zip file because I have to deal with a large number of users who may or may not be very computer literate. From my experience, the least amount of user-interaction is best. The more they have to do, the more calls we get. ~[ cid ]~
cid@ciddivine.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top