You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by raptor <ra...@unacs.bg> on 2001/07/13 17:56:30 UTC

[ASP] FileUploadMax --> FileMaxUpload

hi,
FileUploadMax wrongly stated in ASP docs, U should use :

PerlSetVar FileMaxUpload  xxx

instead.
One more thing, does someone knows a way to capture the error, if the user
tries to upload bigger file than accepted.
So I can inform him.
Is it possible to set CGI::POST_MAX on a per request i.e. dynamicly as I
read in the dosc ASP.pm set this value every time before it calls CGI to
handle the request...

Thanx alot
=====
iVAN
raptor@unacs.bg
=====


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: [ASP] FileUploadMax --> FileMaxUpload

Posted by Joshua Chamas <jo...@chamas.com>.
raptor wrote:
> 
> hi,
> FileUploadMax wrongly stated in ASP docs, U should use :
> 
> PerlSetVar FileMaxUpload  xxx
> 

I think its OK as is, from ASP.pm:

            if($asp->{file_upload_max} = $r->dir_config('FileUploadMax')) {
                $CGI::POST_MAX = $r->dir_config('FileUploadMax');
            }

are you getting FileMaxUpload to work?

> One more thing, does someone knows a way to capture the error, if the user
> tries to upload bigger file than accepted.
> So I can inform him.
> Is it possible to set CGI::POST_MAX on a per request i.e. dynamicly as I
> read in the dosc ASP.pm set this value every time before it calls CGI to
> handle the request...

I might check at runtime:

PerlSetVar PerlInitHandler My::Upload

sub My::Upload::handler {
  my $r = shift;
  my $max = 100000;
  if($ENV{CONTENT_LENGTH} > $max) {
     # tell Apache + ASP apps that there's no POST
     $ENV{CONTENT_LENGTH} = 0;
     $r->dir_config("UploadSizeError", 1);
  } else {
     $CGI::POST_MAX = $max;
  }
  200;
}

Then in your ASP apps, you can look for UploadSizeError
in $Server->Config() or Apache->dir_config... you can 
also use $r->notes or $r->pnotes for this, but there's
not ASP API for this.

I suppose that at runtime, Apache::ASP might have a better
API that could make the above unnecessary, like check
that the content length is not too large, and then
not handle the upload, while also setting some variable
like SizeError in the fileupload data, but the above
might be something you could do today.

-- Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: [ASP] FileUploadMax --> FileMaxUpload

Posted by Joshua Chamas <jo...@chamas.com>.
raptor wrote:
> 
> hi,
> FileUploadMax wrongly stated in ASP docs, U should use :
> 
> PerlSetVar FileMaxUpload  xxx
> 
> instead.
> One more thing, does someone knows a way to capture the error, if the user
> tries to upload bigger file than accepted.
> So I can inform him.
> Is it possible to set CGI::POST_MAX on a per request i.e. dynamicly as I
> read in the dosc ASP.pm set this value every time before it calls CGI to
> handle the request...
> 

I posted my answer to this to the asp@perl.apache.org list.

-- Josh