Force Download Link Files?
| From: | Infomart) | Date: | Thu, 17 Apr 2003 20:26:34 +0000 |
| Subject: | Force Download Link Files? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144340@lists.php.net to get a copy of this message | ||
Hi all,
I have some link to some files (.jpg, .doc, .xls) and normally when you
"left" click on it, it would open the file. And if you want to download the
file you would have to "right" click and "save as.." I want to enable my
user to be able to download these files by just "left" clicking on the link.
I have tried many things, I try linking it to a new php page and sent in
some headers, my code:
<?
header("Content-type: application/octet-stream");
header("Content-Disposition: filename='ABC.gif'");
?>
However, it didn't work. Then someone told me to try this,
<?
header("Content-type: application/octet-stream");
header("Content-Disposition: filename='ABC.gif'");
print "bal bla bla";
?>
I did, this time it lets me save the ABC.gif (an dialogue box comes up and
ask me to open or save), and after saving it, when I try to open my file, I
see a big red X (the file is probably empty). I don't know why. Can anyone
please help me? THanks a lot
Kelvin