...

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



whitejm12
12-01-2006, 08:08 PM
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

j9ine
12-01-2006, 11: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">
</form>

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

whitejm12
12-04-2006, 06:51 AM
J9ine:

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

John



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum