Progress bar in php while uploading a file

Discussion in 'PHP' started by debuggers, Jul 9, 2007.

  1. #1
    Hi,

    I am not much familiar with AJAX and i need to show a progress bar while uploading a while which would show time remaining and percentage completed.

    Please provide me best solution.

    Thanks

    Debuggers
     
    debuggers, Jul 9, 2007 IP
  2. pfek

    pfek Member

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #2
    Hi,

    Here are some ressources you should look at.

    This is a tutorial using the xAjax project. It explains pretty much the same thing as you want to do:
    http://wiki.xajaxproject.org/Tutorials:Creating_a_Loading_Message

    You surely will need a visual for the progress bar. You can code and design one for yourself, but the following link might interest you as there are ready-to-use progress bars and other stuffs :
    http://ajaxload.info/
     
    pfek, Jul 9, 2007 IP
  3. Cloudberries

    Cloudberries Peon

    Messages:
    74
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That would work, but to show the percentage of file data uploaded, and not just an "uploading" message would be a bit more complex - it's unfortunately something that's historically been rather tricky to achieve in PHP (something like "35% of 150kb uploaded...")

    With PHP 5.2 and later, there's a relatively simple method of achieving this. I haven't tried it myself yet, but an outline of it is available at
    http://www.ibm.com/developerworks/opensource/library/os-php-v525/

    Other alternatives, with earlier PHP versions, would include patching PHP, and using Perl to check up constantly on the upload progress of the file, and report back with a percentage (something PHP can't do)
    more info on that here: http://tomas.epineer.se/archives/3
     
    Cloudberries, Jul 9, 2007 IP
  4. debuggers

    debuggers Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks everyone for the help,

    I will try those code and if it helps me out i will message you again and you can post the same solution for others.
     
    debuggers, Jul 9, 2007 IP