NAME
ASP4::Request - Interface to the incoming request
SYNOPSIS
if( my $cookie = $Request->Cookies('cust-email') ) {
# Greet our returning user:
}
if( my $file = $Request->FileUpload('avatar_pic') ) {
# Handle the uploaded file:
$file->SaveAs( "/var/media/$Session->{user_id}/avatar/" . $file->FileName );
}
if( $Request->ServerVariables("HTTPS") ) {
# We're under SSL:
}
DESCRIPTION
The intrinsic $Request
object provides a few easy-to-use methods to simplify the processing of incoming requests - specifically file uploads and cookies.
METHODS
Cookies( [$name] )
Returns a cookie by name, or all cookies if no name is provided.
ServerVariables( [$name] )
A wrapper around the global %ENV
variable.
This means that:
$Request->ServerVariables('HTTP_HOST')
is the same as:
$ENV{HTTP_HOST}
FileUpload( $fieldname )
Returns a ASP4::FileUpload object that corresponds to the fieldname specified.
So...if your form has this:
<input type="file" name="my_uploaded_file" />
Then you would get to it like this:
my $upload = $Request->FileUpload('my_uploaded-file');