Saving GIFs in CGI

Discussion in 'Perl' started by edJames, Jul 23, 2003.

  1. edJames

    edJames Guest

    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, Jul 23, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RC
    Replies:
    1
    Views:
    398
    mortb
    Nov 11, 2004
  2. John Kandell
    Replies:
    4
    Views:
    4,162
    eeebop
    Dec 10, 2004
  3. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,511
    Luis Esteban Valencia
    Jan 6, 2005
  4. Replies:
    1
    Views:
    588
    Travis Newbury
    Sep 13, 2006
  5. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    208
    Curt_C [MVP]
    Oct 3, 2003
Loading...

Share This Page