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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:37:55+00:00 2026-06-01T09:37:55+00:00

I am trying to upload a single .csv file in ASP.NET MVC. In my

  • 0

I am trying to upload a single .csv file in ASP.NET MVC. In my .ascx file, I have:

        <div>           
            <input type="file" name="file" id="file" />
            &nbsp &nbsp
           <input type="submit" name="btnSubmit" id="btnSubmit" value="Upload" />
        </div>

The controller action is:

 public ActionResult Upload(HttpPostedFileBase file)
        {
            if (file.ContentLength > 0)
            {
                var fileName = Path.GetFileName(file.FileName);
                var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
                file.SaveAs(path);
            }
            return View();
        }

The problem is that I always get file as Null in the Upload Action. Any suggestions on how to get this working?

  • 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-01T09:37:56+00:00Added an answer on June 1, 2026 at 9:37 am

    Are you sure you have a

    <form enctype="multipart/form-data" method="post">
    <div> bla bla
    </div>
    </form>
    

    ?

    Edit :
    method=”post”

    +

    [HttpPost]
    

    on your action

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

Sidebar

Related Questions

I was trying to upload a csv file to update a table in my
I trying to upload a newsstand application for ipad. I have a icon file
Greetings, I am trying to upload two single static files (a CSS & an
Trying to upload files using Google Gears and ASP.NET... I assume you can as
Trying to upload a form with a file input, only getting the form fields
I am trying to upload a single file in CodeIgniter 2.0.2 in a normal
I'm trying to upload a file using Watin and C#. Under Windows XP, Watin
I am trying to upload a file from a flash widget to my rails
I'm trying to upload an MP3 file (using the paperclip plugin) and then read
I'm trying to upload files within MVC. Most solution I saw on SO is

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.