Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form action= results in file with no extension

    Folks:

    I'm running a script with a single tick-box form and a "Download" button on it. The user must tick the box, then click the Download button, after which

    <form action="tools.exe" method="GET" onsubmit="return checkCheckBox(this)">

    opens the Windows File Download dialog opens so that the user can save the file tools.exe to disk.

    The problem is that, under Internet Explorer, tools.exe comes down without the .exe extension, which means that the user must rename the file on disk to get it to run properly. (Note that this does NOT happen under Firefox, but I need to make it work for IE as well.)

    I've tried qualifying the name of the file (e.g., <form action="http://www.zuzz.com/tools.exe"...) to no avail.

    Any ideas?

    Thanks,

    John

  • #2
    New Coder
    Join Date
    Nov 2006
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I ran a basic test in FF and IE that downloaded a .exe file using a form. In both instances the file was saved with the extension intact. And in IE if you choose to save it instead of run it you will be prompted to enter a filename.

    Perhaps it is your cache that is causing the problem. Try changing the method to post. By using the post method you are forcing the browser to retrieve a new copy of the file/page each time the form is submitted. You could also use the window.open() method instead of submitting the form.
    Code:
    <form action="test.exe" method="POST">
    <input type="submit" value="download">
    </form>
    
    <form>
    <input type="button" value="download" onclick="window.open('test.exe','_self');">
    </form>

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    J9ine:

    Many thanks! window.open() does the trick. Bon weekend to you.

    John


  •  

    Posting Permissions

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