note 54713 modified in function.flush by danbrown
| From: | danbrown@php.net | Date: | Sat, 14 Feb 2009 06:06:40 +0000 |
| Subject: | note 54713 modified in function.flush by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150656@lists.php.net to get a copy of this message | ||
I find that you need to open your ob for it to print . Heres my example that works in IE . Yes - the
strings need to be long for it to flush ...
<?php
ob_start();
for($i = 1; $i <= 10; $i++){
$sourceName = 'filetoupload' . $i;
$imageArray = array();
if(!is_uploaded_file($_FILES[$sourceName]['tmp_name'])) { $imageArray[$num-1] = NULL;
$message="Image $i does not exist (has not been prompted for upload)<br/>"; }
else {
move_uploaded_file($_FILES[$sourceName]['tmp_name'], "temporary/$sourceName");
$message = "Image $i has been uploaded to the server";
}
echo $message;
flush();
ob_flush();
usleep(300);
}
ob_end_flush();
?>
--was--
I find that you need to open your ob for it to print . Heres my example that works in IE . Yes - the
strings need to be long for it to flush ...
ob_start();
for($i = 1; $i <= 10; $i++){
$sourceName = 'filetoupload' . $i;
$imageArray = array();
if(!is_uploaded_file($_FILES[$sourceName]['tmp_name'])) { $imageArray[$num-1] = NULL;
$message="Image $i does not exist (has not been prompted for upload)<br/>"; }
else {
move_uploaded_file($_FILES[$sourceName]['tmp_name'], "temporary/$sourceName");
$message = "Image $i has been uploaded to the server";
}
echo $message;
flush();
ob_flush();
usleep(300);
}
ob_end_flush();
http://php.net/manual/en/function.flush.php