in reply to Upload Progress Bar

Have you thought of using Tk? Something like this would work - then you could bind the action to the upload somehow?
#!/usr/bin/perl use Tk; use Tk::ProgressBar; my $mw = MainWindow->new(-title => 'Processing'); $Progress = $mw->ProgressBar( -width => 30, -from => 0, -to => 100, -blocks => 50, -colors => [0, 'green', 50, 'yellow' ,80, 'red'], -variable => \$percent_done )->pack(-fill => 'x'); $mw->Button(-text => 'Go!', -command=> sub { for ($i =0; $i < 1000; $i++) { $percent_done = $i/10; print "$i\n"; $mw->update; } })->pack(-side => 'bottom'); Mainloop;

Replies are listed 'Best First'.
Scripts Structure still a mystery
by Andre_br (Pilgrim) on Dec 27, 2004 at 22:15 UTC
    Hey everybody!

    Thanks for the effort in helping me out on this! I have found many javascripts that output the progress bar, but the main problem remains: itīs not an actual progress bar. And the upload speed depends on too many elements for me to set up the speed of the blind journey to the 100%.

    The solution, as you already pointed, might be to use a upload hook, from CGI.pm or from Apache::Request. But the thing is that I just canīt understand the syntax:
    $q = CGI->new(\&hook);
    sub hook {
    my ($filename, $buffer, $bytes_read, $data) = @_;
    print "Read $bytes_read bytes of
    $filename\n";
    }
    (CGI.pm's upload hook.) Can anyone help me out on this? Wich variables should I replace here? Shall I put this on the same script where I do the upload routine?
    my $fh = $q->upload( "tabela" );
    Thanks! André