# Subforms and file uploads

**URL:** <https://www.ruby-forum.com/t/subforms-and-file-uploads/137586>\
**Category:** Rails\
**Created:** [May 14, 2008, 12:31pm UTC](https://www.ruby-forum.com/t/subforms-and-file-uploads/137586 "2008-05-14T12:31:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![banry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@banry](https://www.ruby-forum.com/u/banry)\
**Post date:** [May 14, 2008, 12:31pm UTC](https://www.ruby-forum.com/t/subforms-and-file-uploads/137586/1 "2008-05-14T12:31:25Z")

</div>

Hi, i’m a newbie so any help and patience appreciated.

I have a form with fields. Depending on the value in the fields the user  
will need to upload either one or two CSV files.

The problem I have is that i can’t upload more than one file on a form  
cos it doesn’t work. and I need to submit the data from the form as  
well.

so can I have a main form with two sub forms to achieve this, and if so  
How do I do that ?

Ta

---

<div class="post-metadata">

**Author:** ![banry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/898d66/32.png) [@banry](https://www.ruby-forum.com/u/banry)\
**Post date:** [May 22, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/subforms-and-file-uploads/137586/2 "2008-05-22T18:08:48Z")

</div>

On 5/14/08, Colin S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have a form with fields. Depending on the value in the fields the user  
> will need to upload either one or two CSV files.
> 
> The problem I have is that i can’t upload more than one file on a form  
> cos it doesn’t work. and I need to submit the data from the form as  
> well.
> 
> so can I have a main form with two sub forms to achieve this, and if so  
> How do I do that ?

Where’s your non-working code?

I suspect you need to make your file field element capable of sending  
an array of data, rather than a single element. Try naming it file[]  
or such.

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)
