perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Pushor <t...@crossthread.com>
Subject Re: Another stupid question...
Date Tue, 11 Feb 2003 17:06:57 GMT
Richard,

I'm not quite sure why its doing what its doing. I have only done one 
real project with Apache::ASP that handles file uploads, but again, how 
I do it is:

1) Make sure you do a PerlSetVar FileUploadTemp 1 in httpd.conf - this 
will ensure that Apache::ASP actually downloads the file for you and 
puts it into a temporary file. Otherwise you just get a filehandle to 
the file and have to read it and spool it to the file yourself (thats 
how I understood it anyway).

2) Get the hash with a my $upload_file = 
$Request->{FileUpload}{upload_form_element};

3) Get the name of the (temporary) file that Apache::ASP downloaded the 
file into: $filename=$upload_file->{TempFile};

You can then move the file wherever you want. This method works great 
for me.

Tim


Richard Curtis wrote:
<snip>

>
> I have one further query.  If I do the following.. (where "filename" 
> is the name of the file upload box on the html page) :
>
> my $newFileHandle = $Request->Form('filename');
> my $newFileName = $Request->FileUpload('filename','BrowserFile');
>
> Is that the correct syntax ?
> I mean it appear to work, but I still notice something slightly strange.
> If I print them both, they both show the same :
>
> my $newFileHandle = $Request->Form('filename');
> print "file handle: $newFileHandle <br>";
> my $newFileName = $Request->FileUpload('filename','BrowserFile');
> print "name: $newFileName <br>";
>
> ... this gives :
> file handle: points.doc
> name: points.doc
>
> If I print to Data::Dumper as follows :
>
> print Dumper $newFileHandle . "<br>";
> print Dumper $newFileName . "<br>";
>
> I get the following output....
>
> file handle: $VAR1 = bless( \*{'Fh::fh00003points.doc'}, 'Fh' );
> name: $VAR1 = bless( \*{'Fh::fh00003points.doc'}, 'Fh' );
>
> So, what is the difference.
> When I ask for "browserFile" from the FileUpload request object, why 
> is it still a file handle ?
>
> Maybe I am just being incredibly stupid, but I dont see any difference 
> to doing it this way, as to the way I was initially doing it.
>
> Richard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
>



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


Mime
View raw message