I am still trying to create my upload page and currently have a loop running to analyze uploaded files for correct format size ,etc. My problem is I want a way to display after each file in the loop has been analyzed something like this.
We are currently analyzing your upload file.........Then display DONE when it skips to the next file. The problem lies however that when I upload the files, the status message isn't displayed until all the loops are done, after the php has analyzed all the files. It doesn't really make sense for me to include this status message after the entire set has been analyzed, since the user will already know the analyzing has been done. I have my upload code here, can anyone give me a suggestion as to output the status message after each file in the loop has been analyzed. Thanks in advance for any help.
$limit_size="1000000";
$numtracks = $_SESSION['numtracks'];
$r = 1;
if (4 >=$numtracks){
$q = $numtracks;
}
if (4 < $numtracks){
$q = 4;
}
while ($r <= $q){
$songname[$r] = $_FILES['upload']['name'][$r];
$check_imagename[$r] = explode(".", $songname[$r]);
$verify_imagename[$r] = count($check_imagename[$r]);
$extimagename[$r] = @strrchr($songname[$r], ".");
$tmpName[$r] = basename($_FILES['upload']['tmp_name'][$r]);
$file_size[$r] = $_FILES['upload']['size'][$r];
$tmpdelete = $workdir . "/" . $tmpName[$r];
if ($file_size[$r] == ""){
$errorempty = true;
}
if ($errorempty[$r] !==true){
if ($verify_imagename[$r] > "2"){
$errorsongname = true;
}
}
if ($errorsongname !==true and $errorempty !==true){
if ($extimagename[$r] !== ".jpg"){
$errorsong = true;
}
}
if ($errorsongname !==true and $errorsong !==true and $errorempty !==true){
if($file_size[$r] > $limit_size) {
$errorsize =true;
}
}
echo "We are currently analyzing the upload"." ".$_FILES['upload']['name'][$r] . " ";
flush();
$r++;
echo "Done<br><br>";
flush();
}
here is the form that submits it:
<form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\" input enctype=\"multipart/form-data\">
<table width=\"600\" bgcolor=\"#EEEEEE\">
";
if (!isset($_SESSION['uploadcount'])){
$k = 1;
if (4 >= $numtracks){
$i = $numtracks;
}
if (4 < $numtracks){
$i = 4;
}
while ($k <= $i){
echo"<tr><td align=\"left\" valign=\"top\">".$k."</td><td align=\"center\">".$_SESSION['title'][$k]."<input name=\"upload[$k]\" size=\"40\" type=\"file\"><br><br></td></tr>";
$k++;
}
echo"<tr><td></td><td align=\"center\"><input type=\"image\" src=\"images/submitbutton.jpg\" name=\"uploadsongs1\"></td></tr></table></form>";
It outputs everything fine, but all four loops at the end, not after each successive loop like I would like. Thanks Again