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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:52:31+00:00 2026-06-01T17:52:31+00:00

This should be straight-forward, but here goes – we’re using MVC4 to handle a

  • 0

This should be straight-forward, but here goes – we’re using MVC4 to handle a multi-part Form request to upload a binary along with some meta-data via a strongly-typed view in MVC4.

One of the fields is a version number for the file (i.e. something like 0.0.6, 0.4.5-pre, etc…)

I’m getting the following error from the model binder when it tries to bind this version number field to the model field (string type):

{“The parameter conversion from type ‘System.String’ to type
‘Models.NewFileVersion’ failed because no type converter can convert
between these types.”}

Specifically the error can be traced to our “VersionNumber” field – any ideas as to why this might be happening?

Edit: Source code below

NewFileVersion.cs

public class NewFileVersion
{
    [Display(Name = "Version # (0.67, 0.66-pre, etc...)")]
    [Required]
    public string Version { get; set; }

    [Required]
    [StringLength(2000, ErrorMessage = "ChangeLog must be between 30 an 2000 characters", MinimumLength = 30)]
    [Display(Name = "Version Notes (will be visible to end-users)")]
    [DataType(DataType.MultilineText)]
    public string ChangeLog { get; set; }

    [Display(Name = "Target Platform")]
    [UIHint("Enum")]
    public FileType PlatformTarget { get; set; }
}

New.cshtml

    @model ViewModels.NewFileVersion
@{
    ViewBag.Title = "New";
}
<div class="container" id="main-content">
    <div class="row">
        <h2>
            New</h2>
        @using (Html.BeginForm("Create", "Files", FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.ValidationSummary(true)

            <fieldset>
                <legend>NewFileVersion</legend>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Version)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Version)
                    @Html.ValidationMessageFor(model => model.Version)
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.ChangeLog)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.ChangeLog)
                    @Html.ValidationMessageFor(model => model.ChangeLog)
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.PlatformTarget)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.PlatformTarget)
                </div>
                <div class="editor-label">
                    <label for="">
                        File:</label></div>
                <div class="editor-field">
                    <input type="file" name="fileData" required="required" /></div>
                <p>
                    <input type="submit" value="Upload File" />
                </p>
            </fieldset>
        }
        <div>
            @Html.ActionLink("Back to List", "Index")
        </div>
    </div>
</div>

FilesController.cs

 [HttpPost]
    public ActionResult Create(NewFileVersion version, HttpPostedFileBase fileData)
    {
        //if our model is valid
        if(ModelState.IsValid)
        {
            //etc....             
        }

        ModelState.AddModelError("", "Invalid file submission");

        return View("New", version);
    }
  • 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-01T17:52:32+00:00Added an answer on June 1, 2026 at 5:52 pm

    Try renaming the version parameter for your Create action, e.g:

    public ActionResult Create(NewFileVersion fileVersion, HttpPostedFileBase fileData) { ... }
    

    The model binder may be getting confused between the string version model property and the NewFileVersion version action parameter.


    You can see why this happens in the BindModel method, because the model has a property exactly matching the name of the action parameter it tries to bind as a simple type/model rather than a complex one.

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

Sidebar

Related Questions

This seems like it should be pretty straight forward, but I'm apparently confused. I
This might be something very straight forward and I really think it should work
I think this may sound very straight forward, but still something is not working
This should have been pretty straightforward using the DOM but I seem to be
What should be straight forward is not here and I couldnt find a way
There probably is a fairly simple and straight-forward answer for this, but for some
This should be simple, but the answer is eluding me. If I've got a
This should be a elementary question but why is better to use something like
This should be a common scenario, but could not find any relevant post yet..
This should be a simple question, but I just can't recall the relevant API.

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.