Hi guys,

I'm trying to write CGI::Application app which handle a file upload (among 
other things), and I'm stuck because it
doesn't work like CGI.pm, while it probably should.

"Plain ugly CGI"-fashion uploads (w/o CGI::App) work fine for me:

my $query = new CGI;
if (my $fname = $query->param('poster')) {
     my $fh = $query->upload('poster');
     my $content_type = $query->uploadInfo($fh)->{'Content-Type'};
     if ($content_type eq 'image/jpeg' and $fname =~ /.jpe?g$/) {
etc

But when I tried to make similar things with CGI::App, I failed:

($self is a current CGI::App object here)
if (my $file = $self->query()->param('uploaded_file')) {
     my $fh = $self->query()->upload('uploaded_file');
     my $up_info = $self->query()->uploadInfo($fh);
     my $type = $self->query()->uploadInfo($file)->{'Content-Type'};
     my $file_content;
     local $/;
     $file_content = <$file>;
     $self->errormessage(Data::Dumper->Dump([$file, $fh, $up_info, 
$file_content]));

Dumper produces this:

$VAR1 = bless( \*{'Fh::fh00001sidebar-240.jpg'}, 'Fh' );
$VAR2 = undef;
$VAR3 = undef;
$VAR4 = undef;

I've tried $file->handle(), but it's undefined too.
What's wrong with CGI in CGI::App?

I'm definitely using multipart/form-data, and I see it sending in 
LiveHTTPHeaders, so that's not an issue.

-- 
Serguei Trouchelle

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to