Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - Saving GIFs in CGI

 
Thread Tools Search this Thread
Old 07-23-2003, 04:28 PM   #1
Default Saving GIFs in CGI


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;


edJames
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump