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 file to be downloaded???

Status
Not open for further replies.

Telsa

Programmer
Jun 20, 2000
393
US
Is there a code that I can use in my web page to cause a txt file (or any file for that matter) to be downloaded vs having it open in a new window when clicked on?

Anyone?

Mary :)
 
Unless your users are in a trusted app of some sort like an HTA this is unlikely as per the browser security model. An active X control will do it, but not without security warnings jared@aauser.com
 
All I want is the click to trigger that dialog box asking user if they want to open or save the file.
 
ok. just link to it:

<a href=&quot;yourfile.txt&quot;>darg</a>

I think that should work. Unfortunately, I think certain files are associated with the browser and/or browser plugins, so I don't know if you;ll be able to do anything about those. jared@aauser.com
 
what kind of file? if the file isn't automatically opened by a program associated with IE, or some of the programs IE can open within itself, it should ask you to save or open.... adam@aauser.com
 
They are simple readme.txt type of files. But when a user clicks on them, it will open in a new window rather than download. I just would like to trigger that dialog box that asks the user if they want to save or open the file.

Is there no script that will force this to happen?

Mary :)
 
In a way related to my thread &quot;Script needed...&quot;, but in my case, I guess a little more complicated.
If you zip your text file(s), and upload it, then a shift-click on your link should open the default download application!
The same thing would generally happen if you use an .ext (using a binary data type) that has no viewer. But then after the download, the user would have to change it to open it up with his viewer.

Now if someone can come up with an answer for me!

;-)
 
A little more info: These files are for both Unix and Windows users. Would prefer not making two zip files (tar and zip).

Mary :)
 
Am I missing something in this discussion? All a user has to do is right-click the link to get the options to...
Open
Open in a new window
Save target as
Print target
...and several more options.
What's the fuss?
 
The fuss... Is that you're not really answering Mary's or my questions(Need script... A challenge for you). Never was inclined to right-click on a link before... On a picture, video or sound... yes! But on a link... na! Thanks for pointing that out... But it doesn't really answer my question or solve my problem!
I'm looking for an automatic script, where the user's participation is the least of my concerns!
Can you find another way to Rome?

;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top