Hi
Heres my silly Q for the day
I would like to upload a xml file, and would like the file to sent directly to
XMLin().
Im trying to find a way of not have to create the file in /tmp, and heres my
working code.
my $filename = $cgi->param("filename");
#my $filename =~ s/.*[\/\\](.*)/$1/;
my $upload_filehandle = $cgi->upload("filename");
=begin
# YUCK !!!!!!!
#my $upload_dir = "/tmp";
#open UPLOADFILE, ">$upload_dir/$filename";
binmode UPLOADFILE;
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
print "YUP $upload_dir/$filename" if -e "$upload_dir/$filename";
=cut
# :)
#my $xs = new XML::Simple( keeproot => 1, forcearray => 1);
#my $ref = $xs->XMLin( "$upload_dir/$filename" );
my $ref = $xs->XMLin( <$upload_filehandle> );
my $xml = $xs->XMLout($ref);
print $xml;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/