You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Boysenberry Payne <bo...@humaniteque.com> on 2005/11/11 21:36:00 UTC

Help getting a file handle for uploaded files using CGI

I'm getting an undefined value from the code below:

$CGI::DISABLE_UPLOADS = 0;
$CGI::POST_MAX = 100 * 1_048_576;  # 100 MB

my $cgi = new CGI;

print "Size: $ENV{CONTENT_LENGTH}";

my $cgi_file = $cgi->param( "uploaded_file" ) || print "Error Upload 
Failed No File Recieved...";
my $fh = $cgi->upload( $cgi_file ) || print "Error Upload Failed No 
File Handle Created For $cgi_file...";

When I upload an image called image.jpg I get the following printed out:

Size: 3012
Error Upload Failed No File Handle Created For images.jpg...

It seems like it sees the file, just can't make a file handle for it.  
Anyone know what I'm doing
wrong, or how to find out how to get it to work?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

Re: Help getting a file handle for uploaded files using CGI

Posted by Boysenberry Payne <bo...@humaniteque.com>.
Never mind I guess Apache2::Upload is what I'm looking for...
Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 2:47 PM, Boysenberry Payne wrote:

> I forgot I'm using Apache2 and MP2.
> Is there a way to handle file uploads using apreq2?
>
> Boysenberry
>
> boysenberrys.com | habitatlife.com | selfgnosis.com
>
> On Nov 11, 2005, at 2:36 PM, Boysenberry Payne wrote:
>
>> I'm getting an undefined value from the code below:
>>
>> $CGI::DISABLE_UPLOADS = 0;
>> $CGI::POST_MAX = 100 * 1_048_576;  # 100 MB
>>
>> my $cgi = new CGI;
>>
>> print "Size: $ENV{CONTENT_LENGTH}";
>>
>> my $cgi_file = $cgi->param( "uploaded_file" ) || print "Error Upload 
>> Failed No File Recieved...";
>> my $fh = $cgi->upload( $cgi_file ) || print "Error Upload Failed No 
>> File Handle Created For $cgi_file...";
>>
>> When I upload an image called image.jpg I get the following printed 
>> out:
>>
>> Size: 3012
>> Error Upload Failed No File Handle Created For images.jpg...
>>
>> It seems like it sees the file, just can't make a file handle for it. 
>>  Anyone know what I'm doing
>> wrong, or how to find out how to get it to work?
>>
>> Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

Re: Help getting a file handle for uploaded files using CGI

Posted by Boysenberry Payne <bo...@humaniteque.com>.
I forgot I'm using Apache2 and MP2.
Is there a way to handle file uploads using apreq2?

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 2:36 PM, Boysenberry Payne wrote:

> I'm getting an undefined value from the code below:
>
> $CGI::DISABLE_UPLOADS = 0;
> $CGI::POST_MAX = 100 * 1_048_576;  # 100 MB
>
> my $cgi = new CGI;
>
> print "Size: $ENV{CONTENT_LENGTH}";
>
> my $cgi_file = $cgi->param( "uploaded_file" ) || print "Error Upload 
> Failed No File Recieved...";
> my $fh = $cgi->upload( $cgi_file ) || print "Error Upload Failed No 
> File Handle Created For $cgi_file...";
>
> When I upload an image called image.jpg I get the following printed 
> out:
>
> Size: 3012
> Error Upload Failed No File Handle Created For images.jpg...
>
> It seems like it sees the file, just can't make a file handle for it.  
> Anyone know what I'm doing
> wrong, or how to find out how to get it to work?
>
> Thanks,
> Boysenberry
>
> boysenberrys.com | habitatlife.com | selfgnosis.com