נכון לעכשיו אני לומד PHP ואני בדיוק בשלב של הלולאות אם הבנתי נכון מהספר
בשביל לעשות את מה שאתה רוצה תצטרך להשתמש בלולאה do while.
שמה שהיא עושה בעצם זה בצע כל עוד..היא שונה מלולאת ה while בזה שהתנאי
שלה נבדק אחרי כל מעבר על הלולאה.
אז אם הבנתי נכון, אני חושב שזה מה שתצטרך לעשות,
PHP קוד:
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
// use the Content-Disposition header to supply a recommended filename and
// force the browser to display the save dialog.
header("Content-Disposition: attachment; filename=".basename($download_file).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($local_file));
// open file stream
$file = fopen($local_file, "r");
do {
// 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);
} while(!feof($file));
אני מאוד מקווה שזה נכון ואני צודק (: