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");

In reply to Inconsistent Perl code in Internet Explorer 8 by ThePole

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.