I'm playing my novice card here, but when you ask for the source of uploadInfo, what are you asking for? The code for that function? uploadInfo is from CGI.pm, so you want the source from the CGI module?
In the form, the field for the file to upload is
<input type="FILE" name="filename">
The script then gets the filename:
$File_Name = Get_File_Name(param('filename'));
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);
}
and calls sub to store the file ($Directory is a path and is already defined):
storeFiles($File_Name, $Directory);
#stores uploaded files
sub storeFiles{
my($filename, $directory) = @_; #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 guessing the content-type isn't being passed correctly from IE, but I'm not what to change since I've already set the form type as a multipart-form. |