|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I have noticed some posts that relate to this problem HOWEVER mine is quite different. (this is slightly offtopic and I am posting out of desperation)
I am using a Perl script to upload files via web. I use CGI.pm 2.74. The script I have works FINE on Apache on both Windows2000 and Linux. ( I will post this script below) However, it will not work on OS/390 with IBM HTTP server V5.2. It returns error: Malformed Multipart Post. This may be due to ASCII>EBCDIC mistranslations or due to the web server mangling the http header boundary for the file to be uploaded. The error comes from this section of CGI.pm: # Find the boundary in the buffer (it may not be there). my $start = index($self->{BUFFER},$self->{BOUNDARY}); # protect against malformed multipart POST operations die "Malformed multipart POST\n" unless ($start >= 0) || ($self->{LENGTH} > 0); NOTE: Perl CGI in general does work on the system, I tested a few guestbooks and such to rule that out. Big problem seems to be multi-part forms. The perl script is as follows: !/bin/perl -w $donepage = "/upload.htm"; $errorpage = "/errorup.htm"; use CGI; $req = new CGI; $file = $req->param("file"); $path = $req->param("path"); $filename=$req->param("filename"); if ($file ne "" && $path ne "" && $filename ne "") { open (OUTFILE, ">$path/$filename")|| die "couldn't open file $path/$filename!:$! \n"; binmode(OUTFILE); while (my $bytesread = read($file, my $buffer, 1024)) { print OUTFILE $buffer||die "cannot write to file $path/$filename:$! \n"; } close (OUTFILE); print "Content-type: text/html\n"; print "Location:$donepage\n\n"; } else { print "Content-type: text/html\n"; print "Location:$errorpage\n\n"; } As I said I am a bit OT but would appreciate any input. Also anyone else here is free to try to use the above code to solve their own problems. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > More CGI upload problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|