I'd like to upload all images to a specified server directory whose names 
are written in <img src="imagefilename"> in a textarea field.

I'm extracting the filenames through a regexp and store them in an array.
Then each array element is given the proper server path, a few checks on 
filenames are run, and the files are uploaded.

The problem I'm having is to set the right filehandle.
Using CGI.pm, it seems uploading only works when the filehandle through 
which the file is read is the same as the local filename, but only when 
that name is retrieved through parsing the query-string:

my $q = new CGI;
my $file_handle = $q->param("fieldname");

open (OUTFILE, ">$newfilename") || die("Can't write to $newfilename: $!"),
while (<$file_handle>) {
print OUTFILE;}
close (OUTFILE);

(The same for binary files with
while(read($file_handle, $scalar, 1024)) { print OUTFILE $scalar;}
)

The only solution I can think of is to use Javascript for extracting the 
image file names when the form is submitted and for copying the file names 
to hidden input fields which I can then parse using CGI.pm.

Any other ideas?


Birgit Kellner

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to