1

I want to create multiple file upload with jquery "Next file" button. I was thinking of simething simple like it was posted here: jQuery solution for dynamically uploading multiple files but I have problems with naming.

I'm using a list of HttpPostedFileBase and my name attribute looks like this:

name="FileList.File[0].Content"

I don't want to use Ajax and ask for View from server. I just want to append new line with input with correct name.

Can anyone help?

EDIT:

My FileList model consist not only HttpPostedFileBase Content, but also select Type field. Those fields after render look like this:

select class="input-large" name="FileList.File[0].Type">...< /select>

input name="FileList.File[0].Content" .../>

Those field are rendered in separate View using Html.Editorfor. I want them both to be appended when "Next file" button is clicked.

Community
  • 1
  • 1
Paul K
  • 41
  • 1
  • 8
  • What if you change it to `name="FileList.File[].Content"`? – sroes Jan 03 '14 at 09:25
  • @sroes I made edit to my post. When I do '[]' thing with select and input names, controller doesn't treat this field as object and ignores it. BUT when I statically add [1] to 'select' and '[]' to input name it does the thing. – Paul K Jan 03 '14 at 10:20
  • Check [this answer](http://stackoverflow.com/a/20889987/219933) which I gave for a similar question yesterday. You can adapt it your own way. – Mat J Jan 03 '14 at 10:33
  • You can upvote the answer if you think fit. – Mat J Jan 08 '14 at 07:08
  • I'll do that as soon as I get enough reputation :) – Paul K Jan 08 '14 at 07:15

0 Answers0