Had a look at the glue source code, and it looks like the hook gets passed a
Param, and a data buffer. Using
my ($upload, $buffer) = @_;
$received = $received + length($buffer);
solved my problem...
Regards,
Franck
-Original Message-
From: Franck Mangin [mailto:[EMAIL PROTECTED]
Sent: Saturday, December 03, 2005 3:38 PM
To: apreq-dev@httpd.apache.org
Subject: Upload hooks
I am trying to use the UPLOAD_HOOK in 2.06 to track the
progress of the upload. I understand the api doc. is out of
sync, but from the Changes notes I gathered something like
the following should work:
my $req = Apache2::Request-new($r ,
UPLOAD_HOOK = sub {
$log-info(PARAMS: .
join(',',
@_));
my ($upload, $data_len) = @_;
$size_received =
$size_received +
$data_len;
})
|| $log-error(UP: could not create Apache2::Request);
Unfortunately it looks like my hook receives only one
argument, the name of the file being uploaded. The log_info
above generates this:
[info] [client 192.168.0.117] PARAMS: 10M.bin,,
I have also tried accessing $upload-size in the hook,
without success - $upload seems to be a scalar.
Any hint on how to achieve this would be greatly appreciated!
Thanks,
Franck