Animated gif on upload

Discussion in 'PHP' started by adamjblakey, Apr 30, 2007.

  1. #1
    Hi,

    Right i have a form which submits to an uploading script and what i need is to display animated.gif while the file uploads.

    Any ideas?

    Cheers,
    Adam
     
    adamjblakey, Apr 30, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You have show a hidden div on form submit, which holds an image or whatever. That belongs into JavaScript though.

    
    
    <div id="loading" style="display: none;"><img src="loaing.gif" /></div>
    
    <form action="" method="" onsubmit="document.getElementById('loading').style.display = 'block';">
    
    HTML:
     
    nico_swd, Apr 30, 2007 IP
  3. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #3
    Thanks a lot for that, do you know how i would i go about doing something like the lightbox script so when the users submits it adds a black overlay to the site and puts the loading.gif in the middle.
     
    adamjblakey, Apr 30, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Try asking in the Javascript section.
     
    nico_swd, Apr 30, 2007 IP
  5. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #5
    commandos, Apr 30, 2007 IP
  6. ErectADirectory

    ErectADirectory Guest

    Messages:
    656
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you do the javascript hidden div trick, your first problem you will run into is how long to keep the animated gif running. Bigger files might take 30 seconds while tiny ones take only 2.

    To point you in the right direction, you did post this in the wrong section. For some reason or another php does not give you access to the % of file uploaded so you can give an ETA and show the animated gif for the correct time ... Perl does. A little javascript is necessary also for the hidden div's so you end up with an AJAX solution.

    I can't find the old tutorial I used years ago but this one seems pretty competent.

    http://www.srmiles.com/freestuff/ajax_file_uploader/

    Enjoy, You've got a fun night ahead of you. Very gratifying to get something like this working.
     
    ErectADirectory, Apr 30, 2007 IP