0
저는 PHP로 jQuery를 사용하고 있습니다.PHP로 큰 파일 다운로드
function downloadFile($sFile){
#Main function
header('Content-Type: '.mime_content_type($sFile));
header('Content-Description: File Transfer');
header('Content-Length: ' . filesize($sFile));
header('Content-Disposition: attachment; filename="' . basename($sFile) . '"');
readfile($sFile);
}
나는이 스크립트를 통해 파일을 다운로드 할 수 있습니다, 그러나 (1GB 같은) 큰 파일의 경우 ReadFile을 기능은 다운로드 시작될 때까지 자신의 시간이 필요합니다 : 나는 PHP로 간단한 다운로드 기능을 작성했습니다. 다운로드가 실제로 시작될 때까지 잠깐 기다려야합니다. 내 스크립트를 최적화하는 방법에 대한 아이디어가 있으니 다운로드가 바로 시작 되니?
작은 단위로 파일을 보냅니다. 즉, readfile을 사용하지 않고 fopen/fread 조합을 사용하고 몇 킬로 비트마다 반복 출력합니다. 구현에 대한 자세한 내용은 다음 URL을 확인하십시오. http://stackoverflow.com/questions/14664409/fread-a-lot-slower-for-downloads-than-readfile –
여기를 참조하십시오 - https://stackoverflow.com/ 질문/47827768/how-to-download-large-files-with-php/47827769 # 47827769 – Aplextor