#! C:\perl\bin\perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); my ($i, $line, $t_name, $name, $ver, $comments, $comments_new, $buffer +, $bytesread); my (@fileinput, @table_dat, @data, @fileinput_ap, @comments, @test); # Some Security Holes Plugged $CGI::POST_MAX = 100 * 1024 * 1024; # limit posts to 100M max my $q = new CGI; ######################################### # Get data from input and Untaint # ######################################### $t_name = $q->param('ap_name') or die "Cannot find name: $!"; if ( $t_name =~ /^([a-zA-Z\d_\s]+)$/ ) { $name = $1 } else { print "Content-type: text/html\n\n"; print "Only letters, numbers, underscores and whitespaces are allo +wed in the name field!!"; exit; } ################# # Upload images # ################# # Image my $file_name01 = $q->param('name_upfile01'); my $file01 = $q->upload('upfile01') or die "test:$!"; # Word doc my $file_name02 = $q->param('name_upfile02'); my $file02 = $q->upload('upfile02') or die "test:$!"; mkdir "C:/web/aps/mi/$name", 0755 or die "Cannot make dir: $!"; open (OUTFILE, ">>C:/web/aps/mi/$name/$file_name01") or die "Cannot op +en dir $name: $!"; while ($bytesread=read($file01,$buffer,1024)) { print OUTFILE $buffer; } close OUTFILE; open (OUTFILE2, ">>C:/web/aps/mi/$name/$file_name02") or die "Cannot o +pen dir $name: $!"; while (<$file02>) { print OUTFILE; } close OUTFILE2;
In reply to Trouble Uploading Word Doc and JPG by bkiahg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |