use strict;
use warnings;
use CGI::UploadEasy;
use Data::Dumper;
my $ue = CGI::UploadEasy->new(-uploaddir => '/path/to/upload/directory');
my $info = $ue->fileinfo;
my $cgi = $ue->cgiobject;
print $cgi->header('text/plain');
print Dumper $info;
I get the following output
$VAR1 = {
'1143232971-HIQ050430376_mindre_33.jpg' => {
'ctrlname' => 'imgfile',
'bytes' => '9233',
'mimetype' => 'image/pjpeg'
}
};
This is probably a basic question, but how do I get the filename '1143232971-HIQ050430376_mindre_33.jpg' of the uploaded file?
read perldoc perlref
my $ref = $ue->filinfo;
my %HoH = %{$ref};
Then you have a hash or hashes which is a hash in which the keys are the filenames and the values are hash references.the canonical print idiom from perldoc perdsc is: (although your taste may differ once you develop it):
foreach my $filename ( keys %HoH ) {
print "$filename: { ";
for my $key ( keys %{ $HoH{$filename} } ) {
print "$key =$HoH{$filename}{$key} ";
}
print "}\n";
}
perlmonks.org content © perlmonks.org and Anonymous Monk, boboson, doc_faustroll, zer
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03