Jump to content

show uploading file animated icon like yahoo


vinpkl

Recommended Posts

hi all

 

i have a form that uploads the image. Till the file get uploaded i want to show an uploading animated icon adjacent to input type file field to show user that the uploading is in progress. when uploading finishes it should disappear.

 

i dont want to go for progress bar as its not an easy task.

 

<?php require_once("../config.php");

$msg="";
if(isset($_REQUEST['submit']))
{
$loc=$_REQUEST['banner_loc'];
$path=$_FILES['banner_image']['name'];
move_uploaded_file($_FILES['banner_image']['tmp_name'], "../graphics/" . $_FILES['banner_image']['name']);

$qry="insert into banners_homepage(location,banner_image) values('$loc', '$path')";

if(mysql_query($qry))
$msg="Banner Inserted successfully";
else
$msg="Error Inserting Banner";
}

?>

 

<input type="file" name="banner_image" id="banner_image" size="60" />

 

vineet

Link to comment
Share on other sites

Have you looked into using javasctipy

I used to have a hidden dive that was fixed to the height and width of the screen with an image in the middle, all transparent

 

When they hit sumbit the div gets unhidden and the user is unable to access the page

Link to comment
Share on other sites

Have you looked into using javasctipy

I used to have a hidden dive that was fixed to the height and width of the screen with an image in the middle, all transparent

 

When they hit sumbit the div gets unhidden and the user is unable to access the page

 

hi gevan

 

that is also good idea.

but how will the div know that the image has been uploaded and it can become hidden again.

 

vineet

Link to comment
Share on other sites

hi PFM

 

i need a little help. i m using the script from the url that u gave

 

<script language="javascript" type="text/javascript">
function startUpload(){
     document.getElementById('f1_upload_process').style.visibility = 'visible';
      document.getElementById('f1_upload_form').style.visibility = 'hidden';
      return true;
}

function stopUpload(success){
      var result = '';
      if (success == 1){
         result = '<span class="msg">The file was uploaded successfully!</span>';
      }
      else {
         result = '<span class="emsg">There was an error. !</span>';
      }
      document.getElementById('f1_upload_process').style.visibility = 'hidden';
      document.getElementById('f1_upload_form').innerHTML = result;
document.getElementById('f1_upload_form').style.visibility = 'visible';      
          return true;   
}
</script>

 

This code give me error "object expected on line 23" in status bar in IE7.

 

I dont get any error in Firefox or opera.

 

do i need to change anything acording to Internet Explorer. Or how switch off this error.

 

This is the line where i get error

document.getElementById('f1_upload_process').style.visibility = 'hidden';

 

vineet

Link to comment
Share on other sites

The sample code from that link works for me in IE7.

 

The code expects a form element with an id of f1_upload_process. IE reports the error when the element does not exist, while the other two browsers ignore it.

 

hi PFM

 

I wanted to edit this code but the forum said that you limit exceeded.

 

so here is what i found. This was also part of code. If i write this line

<script language="javascript" type="text/javascript">
window.top.window.stopUpload(<?php echo $result; ?>);
</script> 

 

then i receive error otherwise not.

 

do IE7 doesnt recognise window

 

vineet

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.