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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:40:29+00:00 2026-05-27T04:40:29+00:00

Ok this is driving me potty! I have a simple modal popup triggered by

  • 0

Ok this is driving me potty! I have a simple modal popup triggered by a Ajax.ActionLink in this popup I have a standard HTML file input control as well as some other text fields. When I submit I can get all my text fields no problem but the file is always null. Below is a copy of my code:

Update Action:

[HttpPost]
    public ActionResult UpdateClip(ClipModel model, HttpPostedFileBase FileData, string clipID)
    {
        return RedirectToAction("Clips");
    }

This is the form from the partial which is shown in the modal window:

<div class="modal_content">
    @using (Html.BeginForm("UpdateClip", "EditProfile", new { clipid = Model.ID }, FormMethod.Post, new { @id = "modalpopupform", enctype = "multipart/form-data" }))
    {
        <ul class="list_to_row">
            <li class="cell" style="width: 75px">Clip Description</li>
            <li class="cell">
                @Html.TextBoxFor(m => m.Description, new { style = "width: 350px" })<br />
                @Html.ValidationMessageFor(m => m.Description)
            </li>
        </ul>
        <ul class="list_to_row">
            <li class="cell" style="width: 75px">Base Cost</li>
            <li class="cell">
                @Model.BaseCost
            </li>
        </ul>
        <ul class="list_to_row">
            <li class="cell" style="width: 75px">Cost</li>
            <li class="cell">
                @Html.TextBoxFor(m => m.UserCost, new { style = "width: 350px" })<br />
                @Html.ValidationMessageFor(m => m.UserCost)
            </li>
        </ul>
        <ul class="list_to_row">
            <li class="cell" style="width: 75px">Preview Image</li>
            <li class="cell">
                <input type="file" id="file" name="file" />
            </li>
        </ul>
        <div class="clearfix"></div>
        <div class="modal_button_area">
            <input id="submitmodalpopup" type="submit" value="Update" class="button" />
            <input id="closemodalbox" type="button" value="Cancel" class="button" />
        </div>     
    }
</div>

Can someone please shed some light on this? Google doesn’t seem to have anything wheather its my combination of words or if I’ve missed something simple I don’t know. Cheers.

  • 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-27T04:40:30+00:00Added an answer on May 27, 2026 at 4:40 am

    In your action the argument is called FileData so be consistent in your markup as well:

    <input type="file" id="file" name="FileData" />
    

    Or if you want to keep file as name of your input, then rename the argument in your action:

    [HttpPost]
    public ActionResult UpdateClip(ClipModel model, HttpPostedFileBase file, string clipID)
    {
        return RedirectToAction("Clips");
    }
    

    But personally I would include this file as property of my view model and I won’t bother with an additional argument:

    public class ClipModel 
    {
        ... some properties
    
        public HttpPostedFileBase File { get; set; }
    }
    

    and then in my strongly typed view I will use a strongly typed helper to generate the file input so that I don’t have to worry about proper naming:

    <li class="cell">
        @Html.TextBoxFor(x => x.File, new { type = "file" })
    </li>
    

    and your controller action signature will be as simple as:

    [HttpPost]
    public ActionResult UpdateClip(ClipModel model)
    {
        return RedirectToAction("Clips");
    }
    

    which is how most POST controller action signatures should look like.

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

Sidebar

Related Questions

This is driving me crazy... With this simple code I keep getting file not
This is driving me insane. I have a JS file that is: Ext.onReady(function(){ Ext.QuickTips.init();
This is driving me nuts... I have an input string like so: String input
This is driving me nuts. I have a simple spring app with just a
This is driving me crazy. I have this one php file on a test
This is driving me absolutely bonkers, and it seems like such a simple thing
This is driving me crazy. I have a PHP script that gets some data
This is driving me mad so please help if you can... I have a
This is driving me nuts, I have been through every article I have seen
This is driving me crazy! I have read at least 5 questions on here

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.