I have a textarea on a form whose content may contain references to images (with their full local path, like "e:\images\image.jpg").
I want dbman to parse the textarea input, filter out all image filenames and upload the images automatically to the server.
My question is: How would I assign a filehandle to the image?
The following code works (with CGI.pm) when there's an input field on a form to which the image name is associated:
...
my $filename = $in{'fieldname_for_image'};
my $filehandle = $q->upload("fieldname_for_image");
... (do stuff to replace local with server file path, store server file name in $newfilename)
open (UPLOADFILE, ">$newfilename") || &cgierr("Won't open $newfilename: $!");
while (<$filehandle>) {
print UPLOADFILE;}
close (UPLOADFILE);}
But what kind of filehandle do I need to assign to an image file with no associated input field name? Would this mean I can't use CGI.pm's "upload" facility?
Confusedly yours,
kellner
I want dbman to parse the textarea input, filter out all image filenames and upload the images automatically to the server.
My question is: How would I assign a filehandle to the image?
The following code works (with CGI.pm) when there's an input field on a form to which the image name is associated:
Code:
my $q = new CGI; ...
my $filename = $in{'fieldname_for_image'};
my $filehandle = $q->upload("fieldname_for_image");
... (do stuff to replace local with server file path, store server file name in $newfilename)
open (UPLOADFILE, ">$newfilename") || &cgierr("Won't open $newfilename: $!");
while (<$filehandle>) {
print UPLOADFILE;}
close (UPLOADFILE);}
But what kind of filehandle do I need to assign to an image file with no associated input field name? Would this mean I can't use CGI.pm's "upload" facility?
Confusedly yours,
kellner