[Catalyst] Re: On fantastic catalyst plugin, Catalyst::Plugin::UploadProgress

Yoshinori Sano yoshinori.sano at gmail.com
Wed Nov 23 07:54:38 CET 2005


Andy Grundman wrote:
> Don Arbow wrote:
> > Does this really work in Apache, or are you testing it with HTTP Engine?
> >
> >  From my testing some time back (not in Catalyst), the "progress" that
> > appears is not the actual upload, but the copy from Apache's tmp file to
> > the CGI's tmp variable. By the time that you get any progress, the file
> > has already moved over the wire. I was under the impression that the
> > only way to get actual progress was to hook into Apache (Apache::Request
> > has an upload hook).
>
> Yes, it really works. :)  It's been tested in the standalone engine,
> Apache, FastCGI, and plain old CGI.

As Andy Grundman explains, it works properly.
However, we have to pay for a minute to get expected results.

Here is the instruction:

1. Enable the "$upload->copy_to()" line.

Index: Catalyst-Plugin-UploadProgress/example/Upload/lib/Upload/C/Upload.pm
===================================================================
--- Catalyst-Plugin-UploadProgress/example/Upload/lib/Upload/C/Upload.pm
       (revision 2134)
+++ Catalyst-Plugin-UploadProgress/example/Upload/lib/Upload/C/Upload.pm
       (working copy)
@@ -24,7 +24,7 @@
     my $upload = $c->request->uploads->{upload_file};
     if ( $upload ) {
         # we could do this, but we'll just throw away the file for now
-        # $upload->copy_to( '/var/tmp/uploads/' . $upload->filename );
+        $upload->copy_to( '/var/tmp/uploads/' . $upload->filename );
     }

     my $progress = $c->upload_progress( $c->req->params->{upload_id} );


2. Type the following commands at your terminal.
$ mkdir /var/tmp/uploads/
$ chmod 777 /var/tmp/uploads/


3. Start the test server.
$ ./Catalyst-Plugin-UploadProgress/example/Upload/script/upload_server.pl -f


4. Upload any file you want.

--
Yoshinori Sano



More information about the Catalyst mailing list