"File Uploading" graphic
Moderator: General Moderators
"File Uploading" graphic
ive searched around for an answer to this but keep hitting walls. i want to be able to have an upload script that will show an animated "uploading" graphic when i click the submit button. unfortunately it shows it after the file is uploaded which is useless. i dont want to go as complex as a progress bar. just a simple graphic.
Re: "File Uploading" graphic
Hi, you definitely need some JavaScript magic to implement uploading animation.
For example, you can post file to a hidden iframe and in the same time start animation. As soon as file is uploaded, iframe will echo the JS-code, which will stop animation at the main page.
For example, you can post file to a hidden iframe and in the same time start animation. As soon as file is uploaded, iframe will echo the JS-code, which will stop animation at the main page.
Re: "File Uploading" graphic
so should i have an "onclick" event that will run as soon as i click the submit button? i saw other sites talking about AJAX which i dont know and i want to keep it as simple as possible
Re: "File Uploading" graphic
for anyone who is interested this is what i used finally. hope its of help. thanks awebtech for steering my brain down the right road
Code: Select all
<?php
session_name("..........");
session_start() ;
$isadmin = $_SESSION [ "level" ];
if ($isadmin == 1){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Image</title>
function imageUploading() {
document.getElementById("uploading").style.visibility = 'visible';
}
//-->
</script>
</head>
<body>
<form action="........." method="post" enctype="multipart/form-data" class="uniForm" name="image">
<input name="upim" size="25" type="file" />
<input class="button1" type="submit" name="upimage" value="Submit Image" onclick="imageUploading();"><br /><BR />
<span id="uploading" style="visibility:hidden">IMAGE UPLOADING<img src="../Images/loader.gif"/></span>
</form>
</body>
</html>
<?php } //closeing admin check
Re: "File Uploading" graphic
You can use a flash uploader like uploadify to show real progress bar.
Or you can upload in an iframe and show progress with ajax, if you use PHP 5.2+ with APC
Or you can upload in an iframe and show progress with ajax, if you use PHP 5.2+ with APC
Re: "File Uploading" graphic
Da_Elf, thanks for posting your solution
Other people will be able to solve the same problem.