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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -