If $query->upload('fullimage_file') || $query->upload('thumbnail_file'
+) {
should be
if( $query->upload('fullimage_file') || $query->upload('thumbnail_file
+') ) {
(The
if is lowercase and parens were added)
Also the } on line 43 should be moved to line 27.
That is, instead of
if( $query->upload('fullimage_file') || $query->upload('thumbnail_file
+') ) {
my $img_name = $query->param('item');
my $full_pic = $query->upload('fullimage_file');
my $thumb_pic = $query->upload('thumbnail_file');
my $fullname = basename($full_pic);
my $thumbname = basename($thumb_pic);
my ($F_name, $f_ext) = split /\./, $fullname,2;
my ($T_name, $t_ext) = split /\./, $thumbname,2;
my $short_name="$img_name\.$f_ext";
my $short_tname="$img_name\_t\.$t_ext";
my $new_name = "$doc_root$img_folder/$short_name";
my $new_tname = "$doc_root$img_folder/$short_tname";
if ($full_pic ne ''){
open (OUTFILE,">$new_name");
binmode OUTFILE;
while ($bytesread=read($full_pic,$buffer,1024)) {
print OUTFILE $buffer;
}
}
if ($thumb_pic ne ''){
open (FILE,">$new_tname");
binmode FILE;
while ($bytesread=read($thumb_pic,$buffer,1024)) {
print FILE $buffer;
}
}
}
you should have
if( $query->upload('fullimage_file') || $query->upload('thumbnail_file
+') ) {
my $img_name = $query->param('item');
my $full_pic = $query->upload('fullimage_file');
my $thumb_pic = $query->upload('thumbnail_file');
my $fullname = basename($full_pic);
my $thumbname = basename($thumb_pic);
my ($F_name, $f_ext) = split /\./, $fullname,2;
my ($T_name, $t_ext) = split /\./, $thumbname,2;
my $short_name="$img_name\.$f_ext";
my $short_tname="$img_name\_t\.$t_ext";
my $new_name = "$doc_root$img_folder/$short_name";
my $new_tname = "$doc_root$img_folder/$short_tname";
}
if ($full_pic ne ''){
open (OUTFILE,">$new_name");
binmode OUTFILE;
while ($bytesread=read($full_pic,$buffer,1024)) {
print OUTFILE $buffer;
}
}
if ($thumb_pic ne ''){
open (FILE,">$new_tname");
binmode FILE;
while ($bytesread=read($thumb_pic,$buffer,1024)) {
print FILE $buffer;
}
}
making those changes will at least get it to compile (with some warning). Whether it runs correctly or not is another matter.
davidj
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.