[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-web
Subject:    Re: CGI::Application and file uploading
From:       Serguei Trouchelle <stro () railways ! dp ! ua>
Date:       2009-08-31 10:02:18
Message-ID: 4A9B9FAA.5070907 () railways ! dp ! ua
[Download RAW message or body]

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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic