You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by "John D. Leonard II" <jo...@ce.gatech.edu> on 2001/11/03 12:11:33 UTC

File uploads

All:

I'm struggling with a FileUpload problem.  My form works properly, but my
$Request->{FileUpload} variable is not getting set.  I'm running Apache::ASP
2.27 on Apache 1.3.20 and modperl 2.25.  (I have gotten similar code to work
on a different machine - so I'm thinking that I've got some configuration
setting messed up.)

Here is my test code:

    my $filehandle;
    if($filehandle = $Request->Form("link_upload_file")) {

      my $upload = $Request->{FileUpload}->{link_upload_file};

      $Response->Debug("doing my thing!");
      $Response->Debug( $filehandle );
      $Response->Debug( $Request->{FileUpload} );

    }

My $filehandle is set properly (see below.) $Request->{FileUpload} is not
getting set.  Below is the debug trace from the code above.  Note the blank
line after "doing my thing."

[Sat Nov  3 06:07:21 2001] [error] [asp] [20174] [debug] [index.asp] - doing
my thing!
[Sat Nov  3 06:07:21 2001] [error] [asp] [20174] [debug] [index.asp] -
C:\Documents and Settings\JLEONARD\Desktop\ITSC 2002 CFP.pdf
[Sat Nov  3 06:07:21 2001] [error] [asp] [20174] [debug] [index.asp] -
[Sat Nov  3 06:07:21 2001] [error] [asp] [20174] [debug] done executing
include code Here is the code from my form:

Here is a line from my FORM

  <INPUT TYPE="file" NAME="link_upload_file" VALUE="starting value" SIZE=30
MAXLENGTH=128>

And here is my .htaccess stuff:


PerlSetVar Global /home/htdocs/gati/_private
PerlSetVar StateDir  /tmp/gati

PerlSetVar StatINC 0
PerlSetVar StatINCMatch 0
PerlSetVar Clean 0
PerlSetVar DynamicIncludes 1
PerlSetVar FileUploadMax 500000
PerlSetVar FileUploadTemp 1
PerlSetVar SessionQueryParse 0
PerlSetVar SessionQuery 1
#PerlSetVar Debug 2
PerlSetVar Debug -1


Any clues?

Thanks,

JL
------
John D. Leonard II, Associate Professor            Phone: 404/894-2360
School of Civil and Environmental Engineering       FAX:  404/894-2278
Georgia Institute of Technology           http://traffic.ce.gatech.edu
Atlanta, GA  30332-0355              mailto:john.leonard@ce.gatech.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


RE: File uploads

Posted by "John D. Leonard II" <jo...@ce.gatech.edu>.
>   <FORM METHOD="POST"  ENCTYPE="multipart/form-data">
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AAARRRGGGHHHH!!!!!!!!!!!!!

I guess I didn't port my code as completely as I thought.

Thanks, Joshua!

JL

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: File uploads

Posted by Joshua Chamas <jo...@chamas.com>.
"John D. Leonard II" wrote:
> 
> All:
> 
> I'm struggling with a FileUpload problem.  My form works properly, but my
> $Request->{FileUpload} variable is not getting set.  I'm running Apache::ASP
> 2.27 on Apache 1.3.20 and modperl 2.25.  (I have gotten similar code to work
> on a different machine - so I'm thinking that I've got some configuration
> setting messed up.)
> 

The $Request->{FileUpload} init gets triggered by these if blocks:

    if(($r->method() || '') eq 'POST') {	
	$self->{TotalBytes} = $ENV{CONTENT_LENGTH};
	if($ENV{CONTENT_TYPE}=~ m|^multipart/form-data|) {

so please be sure that your form looks like:

  <FORM METHOD="POST"  ENCTYPE="multipart/form-data">

If your code works on one machine but not another, make
sure your CGI.pm versions are the same.  I have often heard
how upgrading to the latest CGI.pm can break the file upload
( over the years, not necessarily the actual latest CGI.pm ).

> My $filehandle is set properly (see below.) $Request->{FileUpload} is not
> getting set.  Below is the debug trace from the code above.  Note the blank
> line after "doing my thing."
> 

I should add some system level debugging during the file upload processing,
which would help during Debug -1 traces.

>   <INPUT TYPE="file" NAME="link_upload_file" VALUE="starting value" SIZE=30
> MAXLENGTH=128>
> 

For further help, I can email you a 2.29 with some extra debugging
in the file upload block, and maybe we can get a hint as to what's
going on.  Let me know if you need this.

-- Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org