You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Hector Pizarro <hp...@amautatech.com> on 2002/09/10 19:35:18 UTC

help with incomplete uploads

Hello, I'm using this module with the Perl API in a new project where
there are a lot of heavy files to be uploaded to the web server. My
problem is, when I'm uploading a 100Mb file and close the popup with the
form, the process continues anyway in the apache and my module saves the
incomplete file as if it would be done. All my logic to manage the file
is inside a loop like this:

for $upload ($apr->upload)
	{
	...code that saves the file...
	}

My question is, is there any way to check if the upload is complete
before I save the file? I understood from the docs on the apreq mod that
"$upload ($apr->upload)" fetchs all that file and info related, but from
experience it seems it doesnt check if the upload is complete...

Thanks for your time people.

Hector Pizarro

Re: help with incomplete uploads

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Hector Pizarro <hp...@amautatech.com> writes:

> No, it doesn't work. 

You need to be more specific in order to track down the bug.
$apr->parse *should* return an error code if the upload is incomplete;
if that's not happening for you, you need to provide specific details
(apache config, actual handler code, error log output, etc.)
so others can reproduce your exact problem.

> By the way, i don't get how instance() works, do you use it?

Sometimes.  You might want to check the archives of the 
modperl@perl.apache.org list; it's been discussed there
a few times.


-- 
Joe Schaefer

Re: help with incomplete uploads

Posted by Hector Pizarro <hp...@amautatech.com>.
No, it doesn't work. By the way, i don't get how instance() works, do
you use it?

Hector


On Tue, 2002-09-10 at 12:52, Joe Schaefer wrote:
> Hector Pizarro <hp...@amautatech.com> writes:
> 
> [...]
> 
> > My question is, is there any way to check if the upload is complete
> > before I save the file? I understood from the docs on the apreq mod that
> > "$upload ($apr->upload)" fetchs all that file and info related, but from
> > experience it seems it doesnt check if the upload is complete...
> 
> The return value of $apr->parse should return an error status (non-
> zero) if the upload was interrupted.  The Apache::Request documentation 
> suggests you try something like
> 
>   my $status = $apr->parse;
> 
>   if ($status) { # error occurred
>     my $errmsg = $apr->notes("error-notes");
>     warn "APREQ ERROR: [$status] $errmsg";
> 
>     # handle error here
>   }
> 
>   # parse successful; upload handling code goes here
> 
> 
> Does this catch the error?
> 
> -- 
> Joe Schaefer


Re: help with incomplete uploads

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Hector Pizarro <hp...@amautatech.com> writes:

[...]

> My question is, is there any way to check if the upload is complete
> before I save the file? I understood from the docs on the apreq mod that
> "$upload ($apr->upload)" fetchs all that file and info related, but from
> experience it seems it doesnt check if the upload is complete...

The return value of $apr->parse should return an error status (non-
zero) if the upload was interrupted.  The Apache::Request documentation 
suggests you try something like

  my $status = $apr->parse;

  if ($status) { # error occurred
    my $errmsg = $apr->notes("error-notes");
    warn "APREQ ERROR: [$status] $errmsg";

    # handle error here
  }

  # parse successful; upload handling code goes here


Does this catch the error?

-- 
Joe Schaefer