Hi, I'm trying to upload an image to the mediawiki using the Mediawiki::API->upload. To do so, i'm using this code:
*# Open a file whose name is $name = "1.jpg"* * open (my $toi,$name) or die "can't open UTF-8 encoded filename: $!"; binmode $toi; my ($buffer, $data); while (my $n=read($toi, $buffer, 65536)) { $data .= $buffer; print STDERR " $n bytes read \n"; } close($toi); * *#upload file my $kq= $mediawiki->upload( { title => $name, summary => 'upload file', data => $data } ) || die $mediawiki-> {error}->{code} . ':' . $mediawiki->{error}->{details};*
And it generated an error: *HTTP::Message content must be bytes at /usr/share/perl5/HTTP/Request/Common.pm line 91* I don't know how to correct it. Any suggestion?
Thank.