View Full Version : form action= results in file with no extension

12-01-2006, 07:08 PM

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?



12-01-2006, 10:33 PM
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.

<form action="test.exe" method="POST">
<input type="submit" value="download">

<input type="button" value="download" onclick="window.open('test.exe','_self');">

12-04-2006, 05:51 AM

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