Hi all.

Long time webmin tinkerer, short time webamin-devel list troller.

I had a question regarding the the improved file upload module and progress bar window.

* Improved handling of large file uploads so that they are no longer read into memory by Webmin webserver. Also added a progress bar window for tracking uploads.

Firstly, my tests have shown that when attempting a file upload to miniserv, the main miniserv process maynot gobble up memory for the download but the spawned CGI that's being posted to does.

I wrote a quick test to see if the fix would be suitable for a module I'm looking at doing. (large file upload) It starts with a simple form:

<form method="POST" action="/test/handleUpload.cgi" enctype="multipart/form-data">
  <input type="file" name="file" id="file" size="20">

My handleUpload.cgi is pretty straightforward too:

    my $fh = new IO::File ">$write_file";
    if(defined($fh)) {
      binmode $fh;
      print $fh $in{'file'};

This is the approach taken by Tim Neimueller (http://www.niemueller.de/webmin/modules/upload/). I assumed the fix was either transparent to the cgi module using this accepted method, or there's some newer/different usage I need to use.

I really hope the fix isn't the applet solution found in the new File module. That's cheating in my book. :-) Though I understand it helped facilitate the progress bar capability.

If I can properly arrange for the file upload to not consume tons of memory, I plan to design a progress bar with an IFRAME form post and Ajax. (which I'll share if I ever get it working)

Here's my top output for a 1.2gig upload. The 1st process is miniserv, while the 2nd is my handleUpload.cgi. Note the large SIZE and %MEM.

 17:20:26  up 6 days,  7:56,  3 users,  load average: 2.42, 1.97, 1.29
2 processes: 1 sleeping, 1 running, 0 zombie, 0 stopped
CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
           total    0.3%    0.0%   15.4%  34.7%     1.3%   48.0%    0.0%
Mem:   382644k av,  378308k used,    4336k free,       0k shrd,    3304k buff
                    280172k actv,   51884k in_d,    4868k in_c
Swap: 10241396k av, 1494184k used, 8747212k free                   40336k cached

22768 root      15   0  5056 1020   652 D     0.0  0.2   0:00   0 miniserv.pl
25332 root      16   0 1181M 254M   420 R    10.9 68.0   8:32   0 miniserv.pl

Any ideas?


- Chris