I am uploading an image to the server in an iframe, however the iframe does not reflect the new upload unless I refresh page. I suspect what is happening is that the html is posting before upload is complete. Here is the source for the iframe. Is my assumption correct, if so how do I wait on download to complete before posting html? <?php $conn = mysql_connect("xxx","xxx","xxx"); mysql_select_db("xxx",$conn); $SQL="Select * From Projects where ClientID = $ClientID and Status = 'Current'"; $ClientID = $_COOKIE["Brag_Flag_user"]; $SQL="Select * From Projects where ClientID = $ClientID and Status = 'Current'"; $result = mysql_query($SQL); $row = mysql_fetch_array($result); $ProjectID = $row["ProjectID"]; $file = "Images/Client_Photos/".$ProjectID.".jpg"; $_FILES['UploadFile']['tmp_name']; move_uploaded_file($_FILES['UploadFile']['tmp_name'],$file); $percent = 0.25; header('Content-type: image/jpeg'); list($width, $height) = getimagesize($file); $newwidth = $width * $percent; $newheight = $height * $percent; $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($file); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $file = "Images/Preview_Photos/".$ProjectID.".jpg"; @imagejpeg($thumb, $file); echo "<html>"; echo "<head>"; echo "<style type='text/css'>"; echo "#LayerPhoto {"; echo " position:absolute;"; echo " z-index:2;"; echo " top: 0px;"; echo " left: 0px;"; echo "}"; echo "</style>"; echo "</head>"; echo "<body>"; echo " <div align='center'>"; echo " <div id = 'LayerPhoto'><img src = '".$file."' id='Photo'></div>"; echo " </div>"; echo "</body>"; echo "</html>"; ?> Code (markup):
Why not run an IF statement to check if it's been uploaded, and if it has, then you will output the HTML? :-/