Results 1 to 5 of 5

Thread: Specify the action for a link depending on its file extension

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2004
    Location
    Kampala, Uganda
    Posts
    28

    Question 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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2004
    Location
    Kampala, Uganda
    Posts
    28
    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.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  5. #5
    New Member
    Join Date
    Nov 2004
    Posts
    9
    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.
    Webmaster of RockmanTV.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width