httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wichitill <>
Subject Re: Problem use Apache::Upload
Date Fri, 30 Jul 2004 14:47:07 GMT
Keith C. Perry wrote:
> 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

Aside from the 'origname' which shouldn't be there, this is how it should 
work. I can't tell from the example why apreq doesn't see the uploaded file 
and returns undef.

You could try adding $req->parse() before accessing the uploads. It's not 
really documented anymore, but seems to be still necessary for big uploads. 
I'm not sure if the API is still in flux, if only the docs are unfinished, 
or if this is a bug.

> 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.

I didn't write $req->upload{'sentfile'}, I wrote $table->{'sentfile'}, which 
uses the tied hash interface of the table class.

View raw message