rahulgsp83 has asked for the wisdom of the Perl Monks concerning the following question:
</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)"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>
regards, rahul"#!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 "
|
|---|
| 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 | |
by Anonymous Monk on Mar 17, 2011 at 08:56 UTC |