perl - How do I upload file using CGI APPLICATION -
hi trying upload image file using perl cgi-application. not sure doing wrong - empty image file (with right name) gets saved.
my $picture = $self->query->param('picture') ;
$buffer; $bytesread;
open (outfile, ">>$user_dir/profile_picture/$picture");
while ($bytesread = read($picture, $buffer, 1024)) {
print outfile $buffer;
}
read " creating file upload field" section of cgi.pm documentation. there see upload method return filehandle.
$fh = $self->query->upload('picture'); $buffer; $bytesread; while ($bytesread = read($fh, $buffer, 1024)) { ... }
Comments
Post a Comment