ユーザーにファイルのダウンロードを強制しようとしています。そのための私のスクリプトは次のとおりです。
$file = "file\this.zip";
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Type: application/zip"); //This is what I need
header("Content-Transfer-Encoding: binary");
readfile($file);
アップロードするファイルは常に .zip ではないため、$file で受信する画像のコンテンツ タイプを知りたいと考えています。これを達成する方法