Realtime progressbar ajax+php ?

Discussion in 'PHP' started by Yazari, Dec 20, 2008.

  1. #1
    Hello,

    I'm currently working on a project that needs to download some large files using a php function i created download($file);


    it simply download a givenfile to a specific directory on the webserver.

    How could I make a progressebar to show the real progresse of the download(); function ?


    please don't tell me to use solutions like :
    for.{... sleep(x) flush() ...}
    Code (markup):
     
    Yazari, Dec 20, 2008 IP
  2. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    As far as I'm aware your only option is to use CGI or Flash.
     
    Yesideez, Dec 20, 2008 IP
  3. Yazari

    Yazari Peon

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    how could flash do the job?
     
    Yazari, Dec 20, 2008 IP
  4. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You'd need to write some ActionScript for your Flash file.

    Not done this myself as I don't use Flash but have seen it on some sites.
     
    Yesideez, Dec 20, 2008 IP
  5. Yazari

    Yazari Peon

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    well, the problem isn't the progressbar itself, the major problem is how do i synchronize between the progressbar and the task being performed..

    say i have a function that shown the current percentage and fills the progressebar according to that given percentage something like : showPbar(int percent)

    once download() is being executed,it fires showPbar(p) to show the %.

    any suggestion ?
     
    Yazari, Dec 20, 2008 IP