Hi I am trying to upload image file using perl cgi-application. Not sure what I am doing wrong - but an empty image file (with the right name) gets saved.
my $picture = $self->query->param('picture') ;
my $buffer;
my $bytesread;
open (OUTFILE, ">>$user_dir/profile_picture/$picture");
while ($bytesread = read($picture, $buffer, 1024)) {
print OUTFILE $buffer;
}
Read the " CREATING A FILE UPLOAD FIELD" section of CGI.pm documentation. There you will see that the upload method will return a filehandle.