stuayres has asked for the wisdom of the Perl Monks concerning the following question:
There are no field naming conflicts. The upload script looks like this:<FORM ACTION="path_to_form.cgi" METHOD="POST" ENCTYPE="multipart/form- +data"> <td><INPUT TYPE="text" NAME="filename" SIZE="10" MAXLENGTH="50"></td> <td><Other form fields....> <td><INPUT TYPE="FILE" NAME="upfile"></td> <td><Other form fields....</td> </tr> </table> <INPUT TYPE="submit" VALUE="upload"><BR> </FORM>
This doesn't work though. It dies at the upload line every time. The upload directory has been chmodded to 777 and the file is created every time, if the 'die's are removed, but never populated. It seems very mysterious to me. A summary of the version of Perl I'm running reveals the following:#!/usr/bin/perl -w use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; use Fcntl qw( :DEFAULT :flock ); $CGI::DISABLE_UPLOADS = 0; $CGI::POST_MAX = 52428800; my $SAVE_DIRECTORY = "full_path_to_save_directory"; my $query=new CGI; my $filename=$query->param("filename") or die "$!"; my $file =$query->param("upfile") or die "$!"; my $fh =$query->upload($file) or die "$!"; <<other code>> open(OUTFILE, ">$SAVE_DIRECTORY\/$filename"); binmode OUTFILE; while ($bytes = read($fh,$buffer,1024)) { $size+=$bytes; print OUTFILE $buffer; } if ($size > 0) { print "$filename uploaded: $size bytes<p>"; }
Can anyone see any yawning great foolish gaps in my work?/usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl . 2.752
|
|---|