progressbar while posting a form - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

progressbar while posting a form

mac_doggiemac_doggie Posts: 488Member
I let people upload files to my site by using the post method of a form like this:

[code=pre]


Vul bestandsinformatie in






[/code]

It is send to a PHP file witch archives the uploaded file. When the files get bigger it would be good to have a progressbar that shows the user how much longer he should wait. Is there a way to do this using this method...? Or is there an alternative method...? I know I could use an FTP connection in my PHP script but then I would have to place my password in the file and I don't like that idea... Is there a way to do it with JavaScript...???;-)
-mac-
mailto:[email protected]
the Netherlands...

Filename

Comments

  • sempersemper Posts: 35Member
    Hi...

    Perhaps this idea will help you a little: try out to setup a timer which replaces a series of dummy transparent images (the progressbar) with colored ones. However, I don't know how to get out the time remaining for the upload; I mean the speed of the connection. Please reply me, if you'll find a solution for this, may be in PHP too. If you like, I'll help you for coding of you progressbar.

    Semper

  • mac_doggiemac_doggie Posts: 488Member
    I'm very new with PHP and Java programming, so I don't know exactly how to do all this, sounds very hard... If you have some sparetime I'd be very greatfull if you would send me an example... If you need more info about my page just tell me and I'll send it to you...

    : Hi...
    :
    : Perhaps this idea will help you a little: try out to setup a timer which replaces a series of dummy transparent images (the progressbar) with colored ones. However, I don't know how to get out the time remaining for the upload; I mean the speed of the connection. Please reply me, if you'll find a solution for this, may be in PHP too. If you like, I'll help you for coding of you progressbar.
    :
    : Semper
    :
    :



    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • Secret_DoomSecret_Doom Posts: 116Member
    Hi mac!
    I don't know about how to get the bytes uploaded from the file, neither the bytes total from the file.

    But I know how to make the bar. Semper suggested images, I don't think that would be a very good solution. Below is a progress bar. I'm supposing that the file's total bytes is on the variable bytestotal and that the bytes uploaded are in the bytesloaded variable.

    [code]



    function progress_start () {
    // Following 2 lines are just to simulate bar progress
    bytesloaded = 0
    bytestotal = 1200

    barline.style.visibility = 'visible'
    bar.style.visibility = 'visible'
    timer = setTimeout('progress()' , 1000)
    // UploadGegevens.submit()
    }

    function progress () {
    // Following line is just to simulate bar progress
    bytesloaded += 30
    timer = setTimeout('progress()' , 1000)
    if (bytesloaded >= bytestotal) { clearTimeout(timer) }
    bar.style.width = (bytesloaded / bytestotal) * 300
    }







    #000066 solid ; VISIBILITY: hidden"> 

    #000066 ; WIDTH: 0 ; HEIGHT: 20 ; BORDER: none ; VISIBILITY: hidden"> 


    [/code]

    Just click on the submit button to simulate the bar progress. Read the comment lines for more info.

    See ya !

    -- Secret_Doom - Leonardo Pignataro --

    [email protected]
    www.batch.hpg.com.br
Sign In or Register to comment.