httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith C. Perry" <netad...@vcsn.com>
Subject Re: Problem use Apache::Upload
Date Fri, 30 Jul 2004 13:45:54 GMT
Quoting Markus Wichitill <mawic@gmx.de>:

> Keith C. Perry wrote:
> > Quoting Markus Wichitill <mawic@gmx.de>:
> >>If you want an Apache::Upload object, you need to pass a field name:
> >>my $upload = $req->upload('foo');
> >>
> >>
>
http://cvs.apache.org/~joes/libapreq2-2.04-dev/docs/html/group__apreq__xs__request.html#upload
> > 
> > I saw that but the way the docs read, its sounds like you don't need a
> parameter
> > there.  
> 
> It says if you don't pass a name, you get an Apache::Upload::Table object in
> 
> scalar context.
> 
> my $uploads = $req->upload();
> my $upload = $uploads->{'foo'};

Ok, I see

> This is different from the apreq1 API, but passing the name works for both 
> versions.
> 
>  > Also when you say field name... field name to what? Is this arbitary?
> 
> The name you gave the HTML form field.
> 
> <input type='file' name='foo'>
> 

I thought that might had been it but I tried a couple of things while I was
waiting.  First here is the form:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd">
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form name="uploadform" action="upload.mpl?1" method="post" enctype="multipart/f
orm-data"><br>
<input name="sentfile" type="file">
<input value="Send File" type="submit">
</form>
</body>
</html>


Now, I tried...

my $upload = $req->upload('sentfile');
my $fname  = $upload->filename('origname');

I get this error...

[Fri Jul 30 09:40:12 2004] [error] Can't call method "filename" on an undefined
value at /www/local/upload.mpl line 18.\n


BTW, you used curly braces in your example to me but I'm assuming that was a
typo.  :)  For my own sanity I tried

my $upload = $req->upload{'sentfile'};

and it does give me a syntax error.

-- 
Keith C. Perry, MS E.E.
Director of Networks & Applications
VCSN, Inc.
http://vcsn.com
 
____________________________________
This email account is being host by:
VCSN, Inc : http://vcsn.com

Mime
View raw message