0

http://timmytheterror.com/home/music_detail/233から音楽ファイルをダウンロードしようとしているとき

ユーザー名でログイン: amar パスワード: 123456 ダウンロードを開始しますが、Apache は他の要求の処理を停止します。ダウンロードが完了するまで、他のページに移動できません。ダウンロードする私のコーディングは

$path = base64_decode($path); $id = base64_decode($id);

        $file_path= "http://timmy-the-terror.s3.amazonaws.com/".$path;

        header('Content-Type: application/octet-stream');
        header("Content-Transfer-Encoding: Binary"); 
        header("Content-disposition: attachment; filename=\"".$path."\""); 
    header("Cache-Control: public");
    header("Location: $file_path");
    readfile($file_path); 

別のウィンドウで開きますが、親ウィンドウが応答しなくなります。

4

1 に答える 1

1

session_write_close(); を追加してみてください。ダウンロードスクリプトに。セッションへのそれ以上の書き込みを停止し、セッションを使用する他のスクリプト/ページを続行できるようにします。

session_write_close();
$file_path= "http://timmy-the-terror.s3.amazonaws.com/".$path;

header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary"); 
header("Content-disposition: attachment; filename=\"".$path."\""); 
header("Cache-Control: public");
header("Location: $file_path");
readfile($file_path); 
于 2013-03-07T12:58:03.943 に答える