When making blog or BBS, usually we use hyper link as following:
<a href="http://blahblah">file1</a>
But above example may not working in case that the platform is multi-byte character based web page.
Now a days, following method is widely used for security reason. Actually following method is trying to send HTTP header before transferring the file binary. It means that the file URL is automatically hided.
<?
$dir="/path/to/file/";
if (isset($_REQUEST["file"])) {
$file=$dir.$_REQUEST["file"];
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename=\"".basename($file)."\"");
readfile("$file");
} else {
echo "No file selected";
}
?>
$dir="/path/to/file/";
if (isset($_REQUEST["file"])) {
$file=$dir.$_REQUEST["file"];
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment; filename=\"".basename($file)."\"");
readfile("$file");
} else {
echo "No file selected";
}
?>
In order to download by above module, following calling URL is to be used.
<a href="http://www.yourdomain.com/download.php?file=download.zip">download.zip</a>
Another posts included in "PHP"
| How to extract file name from given URL ? (0) | 2008/01/21 |
| How to download a file from a certain URL to server ? (0) | 2008/01/21 |
| ISO 8601 format time format string conversion (0) | 2008/02/13 |
| How to block a connection from the certain site ? (0) | 2008/01/14 |
| XMLRPC example (0) | 2008/01/07 |
| How to upload attachments such as image by metaWeblog API ? (0) | 2008/01/07 |
| How to post blog content by metaweblog API ? (3) | 2008/01/02 |
| Posting to a Wordpress Blog Via XMLRPC Using Blogger API (1) | 2007/12/15 |
Trackback : Cannot send a trackbact to this post.
-
Subject Viagra.
2009/03/24 19:29
Viagra. Buy low price viagra. Online viagra. Taking viagra with cialis. Buy viagra.
-
Subject generic ambien
2009/07/28 02:05
Text
-
Subject buy xanax
2009/07/28 02:40
Text
-
Subject order tramadol
2009/07/28 03:16
Text
-
Subject phentermine 37.5
2009/07/28 03:50
Text
-
Subject order valium
2009/07/28 04:25
Text
-
Subject cheap adipex
2009/07/28 05:35
Text
-
Subject discount ultram
2009/07/28 06:11
Text
-
Subject discount phentermine
2009/07/28 06:45
Text
-
Subject purchase nexium
2009/07/28 07:55
Text
-
Subject ephedra online
2009/07/28 08:31
Text
-
Subject alprazolam online
2009/07/28 09:06
Text
-
Subject aciphex online
2009/07/28 09:40
Text
-
Subject buy acomplia
2009/07/28 10:15
Text
-
Subject generic acyclovir
2009/07/28 10:50
Text
-
Subject allegra online
2009/07/28 11:25
Text
-
Subject cheap ativan
2009/07/28 12:01
Text
-
Subject buy bontril
2009/07/28 12:35
Text
-
Subject order butalbital
2009/07/28 13:10
Text
-
Subject generic carisoprodol
2009/07/28 13:46
Text
-
Subject buy cipro
2009/07/28 14:20
Text
-
Subject buy clomid
2009/07/28 14:55
Text
-
Subject discount didrex
2009/07/28 15:31
Text
-
Subject buy ionamin
2009/07/28 19:05
Text
-
Subject different money making ideas
2010/01/29 04:20
moneyideas
-
Subject different money making ideas
2010/01/29 13:10
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas

Prev

Rss Feed