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
$filename
$file
"."
$!
";
}
}
else{$error .= $CGI::VERSION."file not uploaded
$filename
$file
"."
$!
";}
return $self->template({ file => 'customers.html', vars => {error => $error, }});
}
####
my $fhin=CGI::upload('uploadfile')||CORE::die "cannot convert [$filename] into filehandle: $!";