Saving GIFs in CGI

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top