but the $buffer always seems to be empty. Can anyone help. Please email me with ideas: dave@ddsis.net or blanscet_d@hotmail.com Thanks for the time. Dave#!/usr/bin/perl print "Content-type: text/html\n\n"; print "<HTML><HEAD><TITLE>Upload Script</TITLE></HEAD><BODY>"; use CGI; # load the CGI.pm module my $GET = new CGI; # create a new object my @VAL = $GET->param; #get all form field names foreach(@VAL){ $FORM{$_} = $GET->param($_); # put all fields and values in hash } $uploadfile = $FORM{'userfile'}; $orgfile = $FORM{'userfile'}; $uploadfile =~ s/^.*(\\|\/)//; $uploadfile =~ s/\s+//ig; $uploadfile =~ s/\./PsJsDoT/g; $uploadfile =~ s/\-/PsJsDaSh/g; if($uploadfile =~ /\W/){ $uploadfile =~ s/\W/n/ig; # replace any bad chars with the letter " +n" } $uploadfile =~ s/PsJsDoT/\./g; $uploadfile =~ s/PsJsDaSh/\-/g; $filesize = $FORM{'MAX_FILE_SIZE'}; $denverfile = "../data/denver/"; $chicagofile = "../data/chicago/"; $lafile = "../data/losangelas/"; $sanfile = "../data/sandiago/"; ($city,$date,$name,$ext) = split(/\./,$uploadfile); if ($city eq "denver") { $movefile = $denverfile.$uploadfile; }elsif ($city eq "chicago") { $movefile = $chicagofile.$uploadfile; }elsif ($city eq "losangelas") { $movefile = $lafile.$uploadfile; }elsif ($city eq "sandiago") { $movefile = $sanfile.$uploadfile; }else{ $newfile = "../data/$city/"; mkdir ("../data/$city", 0777); chmod(0777, "../data/$city"); $movefile = $newfile.$uploadfile; } print "The file you uploaded was: $uploadfile\n"; print "The file went to directory: $movefile\n"; open(NEW, ">$movefile") || die "Can not open $movefile"; binmode NEW; #switch to binary mode # start reading users HD 1 kb at a time. while ($bytesread=read($orgfile, $buffer, 1024)) { # print each kb to the new file on the server print "buffer: ".$buffer; print NEW $buffer; } close NEW; # close the new file on the server and we're don +e chmod(0777, "$movefile"); print "</BODY></HTML>"; exit;
In reply to upload PDF files by dave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |