How to write a cgi script in perl that accepts output (an image file) from a urlconnection in a Java applet and writes it to the server?
Posted
by
Brad Rock
on Stack Overflow
See other posts from Stack Overflow
or by Brad Rock
Published on 2012-07-08T03:11:36Z
Indexed on
2012/07/08
3:15 UTC
Read the original article
Hit count: 115
I created a Java applet for my web page that creates an image file. I want users to be able to run the applet and create unique images, click a button, and have the image they created be saved to the web server.
I think I have the code down for writing the image to a URLconnection in the Java applet itself after having successfully written a file while running the applet on my system rather than the web page and saving a file to the local disk, and then altering a few things to write to a URLConnection instead of to the local disk (although we shall see how that works too).
I am now trying to write a cgi script in perl that takes the image output from the URLConnection and writes the image to a file on my web server (note: I am a newbie to perl). I have found many examples of how to do something similar with simple text coming from an applet and then writing it to a text file, but I want to know how to apply the same concept to an image. Particularly, how do I read in the image? I've seen text input get read by using read(STDIN, $some_variable)--does the same thing work with an image? Likewise, how do I write the image file? What function do I use?
Thanks for your help. I know that I am rather naive about all of this.
© Stack Overflow or respective owner