|
-
Nov 26th, 2004, 01:37 AM
#1
Thread Starter
Junior Member
Specify the action for a link depending on its file extension
Hello,
On our website users can download templates that are used in one of our applications. The templates are just plain text files of about 5k, and they have the extension .tpl.
Problem is when someone clicks on one of the template links, the page opens in the browser, what we want is the dialog to pop up asking the user where they want to save it.
Is this possible?
Also, is it possible to specify a default path where a file is to be downloaded to. The templates have to be placed in a specific directory and it would be nice if when the dialog pops up this directory is already set, e.g. C:\Program Files\My App\Templates
Thanks
-
Nov 26th, 2004, 03:41 AM
#2
Problem is when someone clicks on one of the template links, the page opens in the browser, what we want is the dialog to pop up asking the user where they want to save it.
Most likely, the server is configured to send unknown files as text/plain. You need to change your server config to send .tpl files as some other MIME type, for example:
text/vnd.yourcompany.template
or
text/x-yoursystem-template
Also, is it possible to specify a default path where a file is to be downloaded to. The templates have to be placed in a specific directory and it would be nice if when the dialog pops up this directory is already set, e.g. C:\Program Files\My App\Templates
No, that's impossible. It wouldn't make sense, either. On my computer, your app would be in
C:\Programme\Your App\
and on my other computer, if there at all, it would probably be in
/usr/share/yourapp/
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 26th, 2004, 03:53 AM
#3
Thread Starter
Junior Member
I added the following line to my .htaccess file
AddType application/octet-stream .tpl
It now downloads the file correctly in Netscape but not IE. I tried it with and without a . in front of the tpl but it made no difference.
-
Nov 26th, 2004, 03:58 AM
#4
Once Netscape handles it correctly that means you've set the server up correctly. Looks like an IE problem. Which is strange.
Try a completely different MIME type?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 29th, 2004, 11:28 PM
#5
New Member
Although this would require the end user to have a unzipping program, all browsers download .zip files to the harddrive instead of opening them in the browser window. Just zip up all of your .tpl templates.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|