Kiko has asked for the wisdom of the Perl Monks concerning the following question:
I had this script running on a developement box under apache and it worked just fine. Now i moved it to a production server and using IIS 5.0 and its not working. Here is the entire upload portion of the script:# This will create the new file in the new location until ( sysopen OUTFILE, UPLOAD_DIR . $uploadedfile, O_RDWR|O_CREAT|O_ +EXCL, 0777 ) { $uploadedfile =~ s/(\d*)(\.\w+)$/($1||0) + 1 . $2/e; $1 >= MAX_OPEN_TRIES and error( $grab_file, "Unable to save your f +ile. File 1" ); }
Thanks in advance for your help. -KikoUPLOAD_FILE: { for my $file_num (1..5) { my $file = $grab_file->param("file$file_num") or next UPLOAD_F +ILE; my ($base,$path,$type)=@_; my $file_handle = $grab_file->upload("file$file_num"); my $buffer = ""; if (!$file && $grab_file->cgi_error) { print $grab_file->header(-status=>$grab_file->cgi_error); exit 0; } if ($file) { $file =~ s/</</g; $file =~ s/>/>/g; fileparse_set_fstype("MSWin32"); ($base,$path,$type) = fileparse($file,'\..*'); my $type = lc $type; my $uploadedfile = $base . $type; $uploadedfile =~ s/[^\w.-]/_/g; if ( $uploadedfile =~ /^(\w[\w.-]*)/ ) { $uploadedfile = $1; } else { error( $grab_file, "Invalid file name; files must star +t with a letter or number." ); } # This will create the new file in the new location until ( sysopen OUTFILE, UPLOAD_DIR . $uploadedfile, O_RDW +R|O_CREAT|O_EXCL, 0777 ) { $uploadedfile =~ s/(\d*)(\.\w+)$/($1||0) + 1 . $2/e; $1 >= MAX_OPEN_TRIES and error( $grab_file, "Unable to + save your file. File 1" ); } # The file needs to be set to binmode in order to save it +on a Win32 system binmode OUTFILE; binmode $file_handle; # This will write the info into the new file while ( read($file_handle,$buffer,BUFFER_SIZE) ) { print OUTFILE $buffer; } close OUTFILE; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$file_size,$ati +me,$mtime,$ctime,$blksize,$blocks) = stat($file); # This will store the file and size in the database push @statement,"INSERT INTO documents (record_id, documen +t, size) VALUES ('$record_id', '$uploadedfile', '$file_size')"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I'm getting an error using error()
by tachyon (Chancellor) on Aug 07, 2001 at 20:37 UTC | |
by Kiko (Scribe) on Aug 08, 2001 at 19:47 UTC | |
|
Re: I'm getting an error using error()
by rchiav (Deacon) on Aug 07, 2001 at 20:34 UTC |