Hi... I have 4 pics ( jpeg) in an array, but i'm having trouble displaying them all. It never displays all pics, tends to display them in random order, and sometimes pics are repeated 2 or 3 times.
Here's the html and the perl code:
html:
perl:
thanks ...
Here's the html and the perl code:
html:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html> <form action="http://localhost/code.pl" method="post" target="_blank" enctype="multipart/form-data" > <input type="file" name="photo" size="15"> <input type="file" name="photo" size="15"> <input type="file" name="photo" size="15"> <input type="file" name="photo" size="15"> <input type="submit" value="Submit"><input type="reset" value="Start Over" /> </form> </html>
Code:
#!/usr/bin/perl
use warnings;
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
my $query = new CGI;
$upload_dir = 'C:/hut/uploads';
my @fh = $query->upload('photo');
my $filename = $query->param("photo");
print "Content-type: text/html\n\n";
foreach my $fhan(@fh){
open (UPLOADFILE, ">$upload_dir/$filename") or error($!);
binmode UPLOADFILE;
while ( <@fh> ) {
print UPLOADFILE;
}
}
close UPLOADFILE;
foreach $fhan(@fh){
print "<img src=\"uploads/$fhan\" alt=\"Pic\">\n";
}
Comment