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

  • SEARCH
  • Home
  • 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 7628845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:40:43+00:00 2026-05-31T05:40:43+00:00

MVC3 VB.NET Application. I have multiple file upload boxes on a form in my

  • 0

MVC3 VB.NET Application. I have multiple file upload boxes on a form in my mvc3 application. Request.Files shows 3 files when I put a break point in the below function and look at it.. Problem is other than coding a counter and using a select case I dont see a way to handle saving each file name to the database column it belongs to… Is there away to assign the variable on the fly I guess you could say So that the foreach loop would drop the file in the correct column.. Ie handoutFile1, handoutFile2 , handoutFile3, Etc…. As it stands the below will overwrite the filename in handoutfile1 every time the loop is gone through….I thought about throwing a counter in the loop and just put a select case on it to assign the db column based on the counter number. Seems like a cheap work around though.

 For Each File As String In Request.Files

                Dim hpf As HttpPostedFileBase = TryCast(Request.Files(File), HttpPostedFileBase)
                If hpf.ContentLength = 0 Then
                    Continue For
                End If

                Dim savedfileName As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\CourseHandouts\" + hpf.FileName
                hpf.SaveAs(savedfileName)
                _filename = hpf.FileName
                courses.handoutFile1 = _filename

            Next
  • 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-05-31T05:40:44+00:00Added an answer on May 31, 2026 at 5:40 am

    I dont know VB.Net but i will try to answer in C# code,

    In your action you can define in parameter as

        [HttpPost]
        public ActionResult Index(IList<HttpPostedFileBase> postedFiles)
        {
            foreach (var file in postedFiles)
            {
                //
            }
            return View();
        }
    

    and in the view like the following,

    @using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "multipart/form-data"  }))
    {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>TestModel</legend>
        @Html.TextBox("postedFiles[0]",null, new { type = "file" })
        @Html.TextBox("postedFiles[1]",null, new { type = "file" })
        @Html.TextBox("postedFiles[2]",null, new { type = "file" })
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC3 application in which I am creating multiple areas, is
I have an ASP.NET MVC3 web application with C# and Razor. Through a form
I have an ASP.NET MVC3 application and I want to link_to an image file
MVC3 vb.net Application using built in session management. I have an mvc3 application that
My application is in Asp.Net MVC3 coded in C#.Net. I have Views which contains
I have an ASP.NET MVC3 application in C# and Razor. In the view MyView
I have a Razor view in my asp.net MVC3 application with a dropdownlist like
I am building an asp.net mvc3 application and I have decided to use areas
Here's the issue at hand: I have developed an ASP.NET MVC3 application using Razor.
I have the following WebGrid in my ASP.NET MVC3 test application. It displays a

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.