I'm trying to display an image while photos are uploading, so users know my website is doing something instead of just sitting there. I can get it to work properly offline, but not online, for some reason. Here's the relevant part of my code:
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST"){
echo '<div id="progress"><img src="images/ani_hiker.gif"/>
<p align="center">Photos uploading...<br/>slow and steady!</p></div>';
ob_end_flush();
flush();
ob_flush();
foreach ($_FILES['files']['name'] as $i => $name) {
//uploading files junk
}
echo '<script language="javascript">
alert("Photos added successfully!");
window.location.href="index.php?username='.$profile_link.'&select=photos";
</script>';
As mentioned before, works perfectly offline, not online. When I try it online, the photos upload, and the div displays after the upload is complete rather than during the upload, and shows up underneath the alert box. The image inside the div does not appear until you've clicked "OK" in the alert box, then flashes for a split second before the div disappears and you're taken to another page (as expected).
I feel like it must be some kind of setting with my server, but I don't know what. I contacted my host company and we disabled output buffering for my entire site, but that didn't fix the problem. I've since resumed output buffering and it's behaving the same as always.