1
httpヘッダーでファイルをダウンロードしようとしていますが、完全にダウンロードされません。アップロードされたファイルsize is 1 MB
とファイルは私のコード336 byte
のサイズでダウンロードされます。HTTPヘッダーファイルが完全にダウンロードされていません
私はちょうどファイルパスSiteURL
でパスを削除し、フォルダからのパスを提供を変更することで、この問題を解決したコード
$attachment_location= "filename";
$filePath= "$siteURL/foldername/filename";
$file_content = file_get_contents($filePath);
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$attachment_location\"");
echo $file_content;
この質問はあなたに答えるかもしれません。https://stackoverflow.com/questions/386845/http-headers-for-file-downloads –