rahulgsp83 has asked for the wisdom of the Perl Monks concerning the following question:

Hi we are getting the following error while trying to upload the file on teamsite server " Software error: Malformed multipart POST For help, please send mail to the webmaster (you@yourdomain.com), giving this error message and the time and date of the error. " code segment from ipl file which is calling ,
"print<<"END"; <body> <form action="/x/iw-bin/FileUpload.cgi" method="post" enctype="multipa +rt/form-data" > <p> File to Upload: <INPUT TYPE="file" NAME="file" > </p> <p> <input type="submit" value="SEND FILE" /></p> <p> <input type="reset" value="CLEAR" /></p> </form>
</body> </html> END " this is upload.cgi.(it is written in interwoven perl so it may be difficult to unstd but i am really stuck at this issue so i am posting in case it helps to find a solution)
"#!D:\PROGRA~1\INTERW~2\TeamSite/iw-perl/bin/iwperl #--------------------------------------------------------------------- +-------- # #--------------------------------------------------------------------- +-------- =head1 NAME =cut use TeamSite::CGI_lite; use CGI; use CGI::Carp qw ( fatalsToBrowser ); use File::Basename; $|=1; $cgi = TeamSite::CGI_lite->new(); $cgi->parse_data(); print<<"END"; Content-type: text/html; charset=utf-8 <html> <HEAD> </HEAD> END my $iwmnt = "y:" ; $main=$cgi->escape_html_data($cgi->{form}{'vpath'}); print $main; my $safe_filename_characters = "a-zA-Z0-9_.-"; $import_target_path = $iwmnt . $main; my $query = new CGI; my $filename = $query->param("file"); $filename =~ s/.*[\/\\](.*)/$1/; my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' ); $filename = $name . $extension; $filename =~ tr/ /_/; $filename =~ s/[^$safe_filename_characters]//g; if ( $filename =~ /^([$safe_filename_characters]+)$/ ) { $filename = $1; } else { die "Filename contains invalid characters"; } my $upload_filehandle = $query->upload("file"); open ( UPLOADFILE, ">$import_target_path/$filename" ) or die "$!"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE; print<<"END"; <body> <p>Thanks for uploading </p> <p>$filename</p> </body> </html> END "
regards, rahul

Replies are listed 'Best First'.
Re: Malformed multipart POST error while uploading file to server
by Anonymous Monk on Feb 03, 2009 at 09:06 UTC
    1) You're using CGI, so use CGI->header to print http headers.
    2) Malformed multipart POST sounds like browser bug (its sending malformed data). To confirm, verify/upgrade your CGI, try different browser combination... eventually you will have to use http://wireshark.org
      Hi, have u found any solution for this? I'm facing a similar issue. Using Teamsite.