0

このスニペットは、ファイルtiffまたはmodiを Web サーバーから Web 経由でユーザーに転送する必要があります。

header('Content-Description: File Transfer');
header('Content-Type: ' . $file_mime_type);
header('Content-Disposition: attachment; filename="' . $file_name . '"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . $file_size);

# till this moment all is fine
echo file_get_contents("path/to/file.tif");
# script fails on line above, and doesnt reach this place

ファイル形式が tiff または modi でない場合、すべて正常に動作し、クライアント ブラウザがファイル (docx/xlsx/pdf/etc.) のダウンロードを開始すると、ユーザーが tiff または modi をダウンロードしようとすると、スクリプトはエラーなしで失敗します。print(file_get_contents("path/to/file.tif"));を試してみました およびreadfile("path/to/file.tif"); エコーの代わりに、結果は同じです

4

1 に答える 1