opensubscriber
   Find in this group all groups
 
Unknown more information…

p : perl-win32-web@listserv.ActiveState.com 31 August 2009 • 6:02PM -0400

Re: CGI::Application and file uploading
by Serguei Trouchelle

REPLY TO AUTHOR
 
REPLY TO GROUP




Hacked it by using

my $query = $self->query();
$query->close_upload_files(1);

if (my $file = $query->param('uploaded_file')) {
    open (my $fh, '<', $query->{'.tmpfiles'}->{*$file}->{'name'}->as_string());

Anyway, I find it strange that query()->upload() doesn't work as expected under CGI::Application.

Serguei Trouchelle wrote:

> 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]));

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

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.