develooper Front page | perl.beginners | Postings from February 2009

Type and Size of the uploaded file

Gunnar Hjalmarsson
February 26, 2009 09:03
Type and Size of the uploaded file
Message ID:
[ Please reply to the beginners list - I don't answer questions privately. ]

Prasath wrote (to me privately):
> I am new in perl, i have to find the type and size of the uploaded 
> file in perl. Send me the syntax to find

With CGI::UploadEasy you can do:

     use CGI::UploadEasy;
     my $ue = CGI::UploadEasy->new(-uploaddir => '/path/to/upload/dir');
     my $info = $ue->fileinfo;
     my $cgi = $ue->cgiobject;
     print $cgi->header('text/plain');
     foreach my $file ( keys %$info ) {
         print "File name: $file\n",
               "\tMIME type: $info->{$file}{mimetype}\n",
               "\tSize: $info->{$file}{bytes}\n\n";

Please see for further 

Gunnar Hjalmarsson
Email: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About