| Store | Cart

Re: CGI::Application and file uploading

From: Serguei Trouchelle <s...@railways.dp.ua>
Mon, 31 Aug 2009 13:02:18 +0300
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

Recent Messages in this Thread
Serguei Trouchelle Aug 27, 2009 11:30 pm
Serguei Trouchelle Aug 31, 2009 10:02 am
Messages in this thread