I have a simple code in PHP that after move a uploaded file, need to print some information, but the problem is, I have a Sleep() inside the IF statement, and all the text before and after the sleep just show when the sleep count end.
Code below:
if(move_uploaded_file($_FILES['uploadvideo']['tmp_name'],$target_path))
{
echo "<pre>";
echo "Your video ".$cname." has been successfully uploaded<br>";
echo sha1_file($target_path)."<br>";
echo md5_file($target_path)."<br>";
ob_end_flush();
flush();
sleep(2);
echo "Please check if your file is good";
echo "</pre>";
}
If I put the flush, and sleep outside the IF everything works good.
The question is the Sleep() statement can be inserted inside a IF?
Thanks!