여기에이 코드가 있습니다. 그러나 사용자가 다운로드 할 수있는 속도를 제한하려면 어떻게해야합니까?PHP로 다운로드 속도 제한하기
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize("uploads/$filename"));
header("Content-disposition: attachment; filename=\"$origname");
readfile("uploads/$filename");
감사!
이것은 내가 시도한 것입니다.
$download_rate = 100;
$ origname = get_file_name ($ file [0]);
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize("uploads/$filename"));
header("Content-disposition: attachment; filename=\'$origname'");
$local_file = "uploads/$origname";
// 플러시 콘텐츠 flush();
// open file stream
$file = fopen($local_file, "r");
while (!feof($file)) {
// send the current file part to the browser
print fread($file, round($download_rate * 1024));
// flush the content to the browser
flush();
// sleep one second
sleep(1);
}
// close file stream
fclose($file);
왜 작동하지 않습니까? 그런 다음 다른 곳에 문제가있을 수 있습니다 무엇을 제안 @mugur 시도한 경우
그래, 나는이 하나를 읽었지만, 나는 그것을 통합하는 방법이 정말로 필요하다. – HarryBeasant
음, 무엇을 시도 했습니까? 어떻게 실패 했는가? 이것은 좋은 출발점처럼 보이므로 모든 사람에게 이미 한 일을 다시하도록 요청하지 마십시오. – Hamish
오류가 발생합니까? 더 빨리 다운로드하거나 어떻게 실패합니까? – Mike