CanMan2004 Posted September 21, 2006 Share Posted September 21, 2006 Hi allI have a php page with a image upload box on it, the code looks like[code]<?phpsession_start();include ("db.php");if ($_POST['action'] == "upload"){if ($addimage == "") { $upfile = "$rows[logo]"; } if ($addimage == ""){ }else{$addimage_name = $random.str_replace(' ', "", $addimage_name);$upfile = "images/".$rand.$addimage_name; if (!copy($addimage, $upfile)) { print "Error"; exit; } createthumb($upfile,$upfile,'',100,''); $upfile = $rand.$addimage_name; $sql ="UPDATE `data` SET `image`='$upfile' WHERE `id`='".$_POST['id']."'"; @mysql_query($sql, $connection) or die(mysql_error()); exit; }}?>[/code]the problem is that if the image is big, it can take some time to upload and resize the image.What I want to do is to display an image on the page while the upload is happening, the image is to show that the file is being uploaded, basically a little animated timer, the problem I have found, is that if I place a[code]<? print "timer.gif"; ?>[/code]just after[code]<?phpsession_start();include ("db.php");if ($_POST['action'] == "upload"){[/code]then it doesnt load the[code]<? print "timer.gif"; ?>[/code]until it has completed uploading a file.Is there a way around this, to display the image as soon as the form is submitted and then to change the image once the script has completed?Any help would be greatThanks in advanceEd Link to comment https://forums.phpfreaks.com/topic/21531-showing-image-during-query/ Share on other sites More sharing options...
shocker-z Posted September 21, 2006 Share Posted September 21, 2006 look into using AJAX good tutorial on http://www.ajaxfreaks.com as PHP is all parsed before any output is given but with AJAX you can check the status of a page and display an output (e.g. an uploaid in progress image) whilste it's uploading..regardsLiam Link to comment https://forums.phpfreaks.com/topic/21531-showing-image-during-query/#findComment-96083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.