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 9063397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:59:22+00:00 2026-06-16T15:59:22+00:00

I need the ability to add multiple file uploads based on the user needs

  • 0

I need the ability to add multiple file uploads based on the user needs BUT the user has to be able to assign a name to the upload for later usage.
As you can see I’m only dynamically adding more file uploads but assign a name to these uploads seems to be my problem.
Is there any way I can achieve this?

Screenshot how it is at the moment

The code in my View :

@using Microsoft.Web.Helpers
@model MusicNews.Web.Models.ViewModel.ArticleCreateModel

@{
    ViewBag.Title = "Create";
}

@section content
{

        @using (Html.BeginForm("Create", "Article", FormMethod.Post,
                      new { enctype = "multipart/form-data" }))
        {
                ...

                @FileUpload.GetHtml("Files",2,true,false,"Add more")

                <p>
                    <input type="submit" value="Create" />
                </p>
        }
}

The code in my controller looks like :

[Authorize]
public ActionResult Create()
{
    ViewBag.ArticleTypes = new SelectList(ArticleTypes, "Type");
    return View();
}


[HttpPost]
[Authorize]
public ActionResult Create(ArticleCreateModel article)
{
    var files = Request.Files;

    if (ModelState.IsValid)
    {
        ...
    }
    return View(article);
}
  • 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-16T15:59:24+00:00Added an answer on June 16, 2026 at 3:59 pm

    You probably have to create additional uploads yourself. This can be done using jQuery, for example:

    Here’s the HTML:

    <div id="uploads">
        <div id="uploadtemplate">
            <input type="file" name="upload" />
            <input type="text" name="FileName" />
        <div>
    
        <a href="#" id="addFile">Add file</a>
    </div>
    

    On load, we’ll clone the “template” in a variable for later use. On click, we’ll clone the template and add it to the document.

    $(function() {/
        $('#addFile').data('uploadtemplate', $('#uploadtemplate').attr('id', '').clone());
    
        $('#addFile').click(function(e) {
            $(this).data('uploadtemplate').clone().insertBefore( $this) );
    
            e.preventDefault();
        });
    });
    

    Your model will be:

    public class Foo {
        public string[] FileName { get; set; } // will contain all file names given by the user
    }
    

    Then parse Request.Files and do the magic you know 🙂 The Foo.FileName field wil lcontain a file name given by the user for every uploaded file. You can use that as the first file in Request.Files will map to Foo.FileName[0] and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add the ability to a program to accept multiple named parameters
I need to add ability to call certain number/account in my iOS app. But
I need the ability for users to add, edit, and delete lists/libraries but not
I need the ability to add FTS3 to a sqlite3 table after it was
I'm working with connected sortable lists and need the ability to add an extra
Interesting dilemma here. I need the ability for users to add links from their
Im building an eCommerce Rails 3.1 site and need the ability to add promotions
I have to build a site that has multiple color options but it also
I'm writing a simple chrome extension. I need to create the ability to add
I am building an e-store and I need to have the ability to add

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.