ThePole has asked for the wisdom of the Perl Monks concerning the following question:
Dear Holy Monks, please advise on the following.
I have a piece of Perl code to do uploading into the database. It works on Internet Explorer 8 of other users but failed on one with the error: Malformed Multipart POST method: data truncated. It works with FireFox however on that user. I would like to know if there are something not well with the code or is purely a browser issue. I have tried repairing, reinstalling Internet Explorer 8 but the error just keep appearing for the user. Using Fiddler shows the error "The Server did not return properly formatted HTTP headers. HTTP headers should be terminated with CRLFCRLF. These were terminated with LFLF". I am thus unsure is the problem with IE or the Perl code. The code in question is:
$|=1; my $data = $q->param("ATTACHMENT_FILE"); #&cgierr("File 0:".$data); # write original file # -------------------------------------------------------- if($data) { my $max_size = 50000; #in kb # read file extension # -------------------------------------------------------- my ($file_obj,$file_ext) = split(/\./,$data); $file_ext = lc($file_ext); #unrelated SQL statements removed for clarity my $directory = "$c{base}{path}/folder/".theYear.theMonth. +refNo; $directory =~ s/\\/\//g; if (!(-e $directory)) { mkdir ($directory, 0755); } $directory =~ s/\\/\//g; &cgierr("Directory does not exist! : $directory\n") if (!( +-e $directory)); &cgierr("Permissions denied! : $directory\n") +if (!(-W $directory)); &cgierr("Specified path is not a directory! : +$directory\n") if (!(-d $directory)); my ($filename,$fullfile); ($directory =~ m,/$,) ? ($fullfile = "$directory$data") : ($fullfile = "$directory/$data"); my ($bytesread, $buffer, $file_size); $file_size = 0; open(OUTFILE,">$fullfile"); binmode( OUTFILE ); while ($bytesread = read($data,$buffer,1024)) +{ print OUTFILE $buffer; $file_size += 1024; } close(OUTFILE); chmod (0666, "$fullfile");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inconsistent Perl code in Internet Explorer 8
by Anonymous Monk on Mar 06, 2012 at 07:19 UTC | |
by ThePole (Initiate) on Mar 06, 2012 at 07:38 UTC | |
by Anonymous Monk on Mar 06, 2012 at 07:58 UTC | |
by tobyink (Canon) on Mar 06, 2012 at 08:16 UTC | |
by Anonymous Monk on Mar 06, 2012 at 08:26 UTC | |
by aaron_baugher (Curate) on Mar 06, 2012 at 10:17 UTC | |
|
Re: Inconsistent Perl code in Internet Explorer 8
by JavaFan (Canon) on Mar 06, 2012 at 07:17 UTC |