Jump to content

Showing image during query


CanMan2004

Recommended Posts

Hi all

I have a php page with a image upload box on it, the code looks like

[code]<?php
session_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]<?php
session_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 great

Thanks in advance

Ed
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.