parasew has asked for the wisdom of the Perl Monks concerning the following question:

i am currently developing the back and frontend for a project which tries to be a meta-ressource for independent media works (http://mmm.ok.ag)

MMM is a publishing platform for visual media productions (moving media) of emerging contemporary artists in various genres.

if people want to upload their video-works i want to create a file-uploading-part which has to handle rather big files (up to ~650MB in the "worst" case)
we have an anonymous ftp-upload, but i wanted to build a web-driven upload from the submission form of the works:

my aim:
  1. upload form with CGI::FormBuilder (the CGI doesn't mean that it's only usable with CGI.pm, also usable with mod_perl)
  2. submit the form to a new window (respectively perl/cgi script)
  3. this window should show the uploading progress
for the last part of this i wanted to use a frame which is 100% width and height, the invisible frame processes the uploading request, the visible frame (with http-equiv-refresh) shows the uploading progress.

there are several RFCs about Form Handling, i read most of them, but my problem now with perl is the following:

i want to extract the Content-length of the http header, and compare it to the temporary file on the server or the data transfered so far.

how to solve this issues in perl/cgi/mod_perl?
thanks a lot,
parasew
  • Comment on accessing http headers from form uploads in cgi/mod_perl

Replies are listed 'Best First'.
Re: accessing http headers from form uploads in cgi/mod_perl
by jdtoronto (Prior) on Sep 19, 2003 at 19:57 UTC
    CGI.pm will do it all for you. As part of the paramters for the file-upload field in a form it will give you the size of the upload, as well as enabling you to specify maximum upload size.

    Doing the server-push for the progress counter is trivial. The server push can be done in CGI.pm or several other modules offer an automation of the process as well.

    jdtoronto

      Most of the hosting companies I've tried restrict script execution time to 5-30 secs to prevent runaway/attacks. So you better be happy to do this on your own box.
Re: accessing http headers from form uploads in cgi/mod_perl
by cees (Curate) on Sep 20, 2003 at 02:47 UTC

    Since you mention mod_perl, you should look into Apache::UploadMeter. It uses the upload hooks in Apache to show the progress of the upload. This will be more efficient than checking the size of the file on disk everytime. It also uses XML and XSLT to display the upload stats to save bandwidth.

    - Cees

Re: accessing http headers from form uploads in cgi/mod_perl
by parasew (Beadle) on Sep 22, 2003 at 12:01 UTC
    thanks jdtoronto and cees for helping me find a solution for both mod_perl and CGI!
    i am just wondering, since the source of Apache::UploadMeter says
    use mod_perl 0.95
    if anyone has this running with mod_perl 2? or maybe Apache::Compat?

    ile pointed me to a nice plugin for Mozilla Firebird that would display sent/ recieved HTTP Headers in realtime: "Live HTTP Headers"
    Adds information about the HTTP headers in 3 ways:
    By adding a 'Headers' tab in 'View Page Info' of a web page.
    By adding a tool in the 'Tools->Web Development' menu to be able to display http headers in real time
    By letting you edit request headers and replay a URL.