Sorry...forgot to mention that I tried that too and it doesn't work either. I found some example code that used that, so I decided to give it a whirl, but no luck. My original code snippet has transitioned while trying everything I can find.
If I call $q->tmpFileName(), it's undefined as well. Is upload() supposed to be saving to /tmp? My permissions are drwxrwxrwt on /tmp. Is that what I need? I'm not able to find much detailed info in any doc.
Error log says: readline() on unopened filehandle at /var/www/perl/modules/Lockbox/User.pm line 1833. | [reply] |
Even though, my other web app is still working, I found something that said some of the versions are screwed up & try v3.10 (was using the latest & greatest at v3.42). ...upload() is still undefined...
What am I overlooking???
| [reply] |
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, }});
}
However, it crashes at the line in CGI::FileUpload.pm that uses the CGI::upload method (back to square 1):
my $fhin=CGI::upload('uploadfile')||CORE::die "cannot convert [$filena
+me] into filehandle: $!";
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).
don't know if I'm getting anywhere or not... | [reply] [d/l] [select] |
| [reply] |