Here's the subroutine for storing the file:
#stores uploaded files
sub storeFiles{
my($filename, $directory, $mime) = @_; #name subroutine variables
my $data;
my $mime = uploadInfo($filename)->{'Content-Type'};
open (STORAGE, ">$directory/$filename") or die "Error: $directory/
+$filename: $!\n";
if($mime !~ /text/){
binmode ($filename);
binmode (STORAGE);
}
while( read($filename, $data, 1024) ){ print STORAGE $data;}
close STORAGE;
}
I'm using the following subroutine to get the filename from the form:
sub Get_File_Name{
if($ENV{HTTP_USER_AGENT} =~ /win/i){
fileparse_set_fstype("MSWin32"); #changed from MSDOS to try a
+nd fix the A:\ problem
}
elsif($ENV{HTTP_USER_AGENT} =~ /mac/i) {
fileparse_set_fstype("MacOS");
}
my $full_name = shift;
$full_name = basename($full_name);
$full_name =~ s!\s!\_!g; # Replace whitespace with _
return($full_name);
}
As for the submit button. It just has a generic name of 'submit' which is not used by the script in any way to identify anything. |