Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:37:38+00:00 2026-06-07T16:37:38+00:00

I have two editor templates: UploadFiles.cshtml: @model HttpPostedFileBase[] @Html.EditorFor(m => Model, UploadFile, new {

  • 0

I have two editor templates:

UploadFiles.cshtml:

@model HttpPostedFileBase[]
@Html.EditorFor(m => Model, "UploadFile", new { multiple = true })

UploadFile.cshtml:

@model HttpPostedFileBase
@Html.TextBox("", Model, new { type = "file", multiple = Convert.ToBoolean(ViewBag.Multiple) ? "multiple" : "" })
<!-- Additional code here i don't wish to repeat in both controls -->

Notice how UploadFiles.cshtml template accepts an array and then calls the UploadFile.cshtml template and passes in multiple = true via the view data.

The problem i have is if i say:

@Html.EditorFor(m => Model.Files, "UploadFiles")

It doesn’t render anything.

However if i say:

@Html.EditorFor(m => Model.File, "UploadFile")

It renders correctly.

I’d appreciate if someone could show me how this can be achieved.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:37:40+00:00Added an answer on June 7, 2026 at 4:37 pm

    In UploadFiles.cshtml, you’re passing Model, which is an array, to UploadFile.cshtml, which does not take an array. Did you mean to wrap that line in a foreach?

    foreach (var file in Model)
    {
        @Html.EditorFor(x => file, "UploadFile", new { multiple = true })
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two types of users: user and editor. I have a User model
I have two editor templates: one for decimal, and one for decimal? (nullable) But
i have two EditorTemplates string.cshtml int.cshtml when i write EditorFor a string or an
I have two questions in regards to the PyDev (Python editor for Eclipse) and
I have two class libraries MyLibrary.dll and MyLibraryEditor.dll for a Unity runtime and editor
In my JTable, I have two editable numeric columns. The editor for both columns
I have two classes (MVC view model) which inherits from one abstract base class.
The scenario Suppose I have the following two model classes: public class ProductColor {
I have a model with some string values.This model, I apply it to two
I have two eclipse plugins(custom text editor plugin and a view plugin as two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.