PHPでファイルのダウンロード

mocadlogo

PHPでファイルをダウンロードさせるサンプル。

http://phpspot.org/blog/archives/2008/02/phpdlphp.html

<?php
header(‘Content-Type: application/octet-stream’);
header(‘Content-Disposition: attachment; filename=”dl.zip”‘);
header(‘Content-Length: ‘.filesize(‘dl.zip’));
readfile(“dl.zip”);
?>