Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm writing a small web application using Perl, HTML::Mason and Apache.

I've been using Mason's usual <%args> method for receiving 'normal' form parameters, and Apache2::Upload for receiving files.

However, I want to write a page that allows a user to upload multiple files, and I'd like to take advantage of HTML5's multiple attribute to input fields. This will look to the server as though there were multiple file inputs in the form with the same name.

The interface for Apache2::Upload doesn't seem to directly support this, allowing you instead to just get the data for a file with a particular parameter name. The documentation alludes to using APR::Request::Param::Table, but I can't find any documentation for doing that.

Please note that I'm not interested in answers that involve adding extra file input fields with different names. This is trivial to handle on the server, and my question doesn't involve front-end scripting at all.

share|improve this question
    
Could the OP please post relevant selections of the code base? This would help myself (and others) give a more thorough answer/explanation. –  Octoberdan Aug 9 '10 at 18:43

1 Answer 1

up vote 3 down vote accepted
+50

Use the multiple attribute (in the form as you described) and then, after submission, call the Apache request object's upload method. That will give you a list of Apache2::Upload instances.

Good luck!

share|improve this answer
    
Does the OP also need to know how to retrieve the request object? If so, I may be able to help with that. –  Octoberdan Aug 6 '10 at 20:02
    
Finally got around to testing this. Thanks. –  SpoonMeiser Aug 10 '10 at 22:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.