itoigawabass

itoigawaのブログ

apache2とphp5にてダウンロード

2005-05-25

apache2 php5の組み合わせにて以下のコードでファイルをダウンロードするとが2Mで止まってしまう。

readfile($file)をPATHではなくURLにしたら全部ダウンロードするようになりました。
php4では問題なくダウンロードできていたのだが詳細についてはよくわからないままです

chdir(dirname($file_path));
if (!headers_sent()) {
header ("Content-disposition: attachment; filename=\"".mb_convert_encoding($file,"SJIS","UTF-8")."\"");
header ("Content-Length: ".filesize ($file));
header ("Content-Type: application/octet-stream");
readfile($file);
}
clearstatcache();

カテゴリー:blog
タグ: