0

If I want my users to download a .zip or .exe file the command is

<a href=filename.exe>Download</a>
or
<a href=filename.zip>Download</a>

This will ask the visitors where to save the file on their hard disk.

But what if I want my users to download a doc/pdf/php/html file and I dnt want the browser to display these on the the browser itself but ask the users to save them.

<a href=filename.php>Download</a> will simple display the page on the browser.


PS: I dont wanna compress them.

Any help appreciated

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by MCP
0

The only thing you can really do is to either change the extension to something the browser won't read and will just download, or tell them to click File>Save As.

0

Actually, if you have

<?php
    header('Content-type: application/msword');
    header('Content-Disposition: attachment; filename="file.doc"');
    readfile('file.doc');
?>

then it will force the browser to save the file with the appropriate name. You can replace content-type with whatever mime type is appropriate

You can view mimetypes by searching the net, or referencing the following:
http://www.webmaster-toolkit.com/mime-types.shtml

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.