SPUG: retrieving image from form element

marlin marlingreene at mindspring.com
Fri Jul 28 12:08:33 CDT 2000

I'm using a file form element to point to a client side image that 
is sent to a server side Perl script. Here is the HTML...

<FORM ACTION="/cgi-bin/handle_image.pl" METHOD="POST" 
	ENCTYPE="multipart/form-data" >
Select an image to send to database...must be .jpg format.<BR><BR>
<INPUT TYPE="file" NAME="image1" ACCEPT="image/gif, image/jpeg"><BR><BR>
<INPUT TYPE="Submit" NAME="submit" VALUE="Send Image">

On the receive side, if I use a typical print keys to see what came
across I can see the data for the image...

foreach $key (keys %in)
	print "$key is $in{$key}<BR>";  #prints image data

However, if I print $in{image1} I get a "document contains no data" error.

Can anyone tell me the correct way to capture the image data and save
it to a file on the server side.

Thanks in advance.

Marlin Greene

	3 Hats Design
	5201 15 Ave NW 
	Suite 220
	Seattle, WA 98107
	206.784.1641 phone
	206.784.2231 fax
	marlin at 3hats.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/

More information about the spug-list mailing list