E
edJames
Hi
Im writing a java applet that calls a perl script to save pictures
generated by the applet locally. The applet converts the onscreen
buffer into a GIF and sends in via POST in a byte stream. The problem
im having is at the cgi end. The data should be saved as a .gif file,
but when I do this nothing gets saved. If I save it as a text file I
get a load of unrecognisable characters. Below is my perl code, ive
tried adding binmode and it made no difference. I have read that i
should be using read() instead of <> because its a binary file but
havent managed to get this to work either.
Any help would be much appreciated
Ed
#!/usr/bin/perl -w
#use constant BUFFER_SIZE => 4_096
#my $buffer = "";
#binmode STDIN;
#binmode OUTPUT;
open (OUTPUT, '>>/Users/ed/Sites/jp.gif') or die "cant open";
binmode OUTPUT;
while(<STDIN>) {
print OUTPUT $_;
}
#$data = read(STDIN, $buffer, BUFFER_SIZE);
#print OUTPUT $data;
close OUTPUT;
Im writing a java applet that calls a perl script to save pictures
generated by the applet locally. The applet converts the onscreen
buffer into a GIF and sends in via POST in a byte stream. The problem
im having is at the cgi end. The data should be saved as a .gif file,
but when I do this nothing gets saved. If I save it as a text file I
get a load of unrecognisable characters. Below is my perl code, ive
tried adding binmode and it made no difference. I have read that i
should be using read() instead of <> because its a binary file but
havent managed to get this to work either.
Any help would be much appreciated
Ed
#!/usr/bin/perl -w
#use constant BUFFER_SIZE => 4_096
#my $buffer = "";
#binmode STDIN;
#binmode OUTPUT;
open (OUTPUT, '>>/Users/ed/Sites/jp.gif') or die "cant open";
binmode OUTPUT;
while(<STDIN>) {
print OUTPUT $_;
}
#$data = read(STDIN, $buffer, BUFFER_SIZE);
#print OUTPUT $data;
close OUTPUT;