hey ..
i want to create a download link which does not display the doc file in the IE explorer. the client should get download notification ..
how to do that..
This is what I had to do in one of my projects and here is the solution that works for me:
<form action="<URL of the doc>" target="_blank">
<input type="button" onClick="this.form.submit();">
</form>
This is the simpler version of the code i used. It does open a new window on click but in case of a doc file the user is prompted with options to open,save or cancel the file.
Hope this helps.
thats an interesting piece of code, varun. i always tell them to download via right click and "save target as" or leave the way it is... lolz
I just used the 'a href' tag and opens the Open/Save dialogue box.
thanks varun your trick just worked fine
| umeshtangnu wrote: |
hey ..
i want to create a download link which does not display the doc file in the IE explorer. the client should get download notification ..
how to do that.. |
if you can run php files on your site try this
| Code: |
<?
$filename = ' put the file path here ';
header("Content-Type: application/force-download");
print @file_get_contents($filename);
|
?>
You could use a program like PHP Arena if your host supports PHP and you have a database but if you just use the a href link, it would still work. I recommend you use a file download software like the one above just incase the a href link doesnt work, that way you can upload files and have your users agree to the terms of service before downloading.