[PHP-users 18638]ファイルを一括ダウンロードさせたい
    yoshiki
    yoshiki @ ann.to
       
    2003年 10月 27日 (月) 16:36:12 JST
    
    
  
こんにちわ。yoshikiです。
$folderで指定したところのファイルをブラウザで一括ダウンロードさせる
スクリプトを組んでいます。
下記のような感じなのですが、これだと複数のファイルが
1つにまとめて出力されてしまいます。
foreachの1ループごとでブラウザへファイルを送ることは可能なのでしょうか?
ご教授お願いします。
$dh = opendir("$folder");
//ファイル情報を配列で取得
while(($entry = readdir($dh)))
{
   if($entry == "." or $entry == ".."){ continue; }
      $file[] = mb_convert_encoding($entry , "S    JIS","SJIS");
}
foreach($file as $key => $value)
{
  mb_http_output("pass");
  header("Content-type: ---");
  header("Content-Disposition: attachment; filename=".$value);
  readfile($folder."/".$value  );
}
    
    
PHP-users メーリングリストの案内