FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

download doc file .

 


umeshtangnu
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..
varun_dodla
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.
aningbo
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
otiscom
I just used the 'a href' tag and opens the Open/Save dialogue box.
umeshtangnu
thanks varun your trick just worked fine
win2k3
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);


?>
minik
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.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.