in reply to Re^2: file upload undefined: Operation now in progress
in thread file upload undefined: Operation now in progress
I've installed CGI::FileUpload to see where that gets me. Here's my current code:
However, it crashes at the line in CGI::FileUpload.pm that uses the CGI::upload method (back to square 1):sub customerupload{ my $self = shift; my $q = $self->query; my @data; my $error = ""; my $filename = $q->param('uploadfile'); my $file; if($filename) { my $filehandle = new CGI::FileUpload(); $file = $filehandle->upload('query'=>$q); my $data; while(<$file>) { $data .= $_; } if($data) { $error = 'Successfull upload'; } else { $error .= $CGI::VERSION."Nothing read<br>$file +name<br>$file<br>"."<br>$!<br>"; } } else{$error .= $CGI::VERSION."file not uploaded <br>$filename< +br>$file<br>"."<br>$!<br>";} return $self->template({ file => 'customers.html', vars => {er +ror => $error, }}); }
The error message actually returns the name of my file i'm trying to upload. The CGI::FileUpload is creating the tmp files in /tmp/CGI-FileUpload dir: the key file (0 K), the key.part file (0 K), and the key.properties file (creates the file_orig, from_id, from_ipaddr, key, pid, and upload_status fields).my $fhin=CGI::upload('uploadfile')||CORE::die "cannot convert [$filena +me] into filehandle: $!";
don't know if I'm getting anywhere or not...
|
|---|