Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old January 30th, 2001, 01:16 PM
venoma venoma is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 0 venoma User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry

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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > More CGI upload problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway