Re: multipart POST problems

1999-12-13 Thread Doug MacEachern

On Thu, 18 Nov 1999, John S. Evans wrote:

 I've been attempting to write a perl module that handles POSTs of type
 multipart/form-data, and have been having a rough time.
 
 I'm using Apache::Request to process the request.  I have dumped the
 content-type of the incoming request, and verified that it's
 "multipart/form-data".  I can use param() to get the parameters, but I can't
 seem to use upload() to access the blocks directly.
 
 I've included the code from my test handler below.  Basically it attempts to
 access a large parameter MIME block two ways - using param() and using
 upload().  The param() version works fine, but the upload() version can't
 find the block.
 
 Any clues?  The only thing that I can think of is that for this test case,
 the MIME type of the "message" block is text/plain (it's in a TEXTAREA
 field, for testing purposes).  Is it possible that Apache::Request will not
 allow me to process "normal" form fields with upload()?

does the libapreq-x.xx/eg/perl/file_upload.pl script work for you?



RE: multipart POST problems

1999-01-17 Thread Tubbs, Derric L

My understanding is that upload() is only for input type="file" only and
that param() handles all of the other form elements.  That's how I've
implemented it here and all works as expected.

BTW, I don't do any checking to see how the form was submitted. I use
Apache::Request for all of my form submission methods and everything works
fine, no matter how the information was submitted.

 --
 From: John S. Evans[SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, November 18, 1999 5:54 PM
 To:   modperl
 Cc:   [EMAIL PROTECTED]
 Subject:  multipart POST problems
 
 I've been attempting to write a perl module that handles POSTs of type
 multipart/form-data, and have been having a rough time.
 
 I'm using Apache::Request to process the request.  I have dumped the
 content-type of the incoming request, and verified that it's
 "multipart/form-data".  I can use param() to get the parameters, but I
 can't
 seem to use upload() to access the blocks directly.
 
 I've included the code from my test handler below.  Basically it attempts
 to
 access a large parameter MIME block two ways - using param() and using
 upload().  The param() version works fine, but the upload() version can't
 find the block.
 
 Any clues?  The only thing that I can think of is that for this test case,
 the MIME type of the "message" block is text/plain (it's in a TEXTAREA
 field, for testing purposes).  Is it possible that Apache::Request will
 not
 allow me to process "normal" form fields with upload()?
 
 -jse
 
 
 sub handler
 {
 my $r = shift;
 my $apr = Apache::Request-new($r);
 my $block;
 my $buffer;
 
 $r-content_type('text/html');
 $r-send_http_header();
 
 $buffer = $apr-param('message');
 $r-print("bMessage:/bbrpre$buffer/prebr");
 
 $block = $apr-upload('message');
 if ($block)
 {
 $r-print("Found message");
 }
 else
 {
 $r-print("No message");
 }
 
 return OK;
 }