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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:12:51+00:00 2026-05-26T18:12:51+00:00

I came across the following issue: I have this model public class Region {

  • 0

I came across the following issue:
I have this model

public class Region
{
    public int RegionID { get; set; }
    public string RegionName { get; set; }
    public HttpPostedFile CustomFile { get; set; }
}

and I have a custom extension html helper method from here.

Now in the view I have the following code:

<%using (Html.BeginForm("ModifyRegion", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))

{%>

  <%: Html.TextAreaFor(x => x.RegionID, Model.RegionID)%>
  <br />
  <%: Html.TextAreaFor(x => x.RegionName, Model.RegionName)%>
  <br />

 <%: Html.FileBoxFor(x=>x.CustomFile, Model.CustomFile) %>

<input type="submit" />

When it reaches my controller action the CustomFile field is empty, but all other fields are properly set. If I change the CustomFile property to string instead of HttpPostedFile, I get correctly the file name (“dog.jpg” for example). Is there any way to get the full HttpPostedFile file correctly?

Thanks in advance,
Tamash

  • 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-26T18:12:52+00:00Added an answer on May 26, 2026 at 6:12 pm

    Try replacing HttpPostedFile by HttpPostedFileBase in your view model:

    public class Region
    {
        public int RegionID { get; set; }
        public string RegionName { get; set; }
        public HttpPostedFileBase CustomFile { get; set; }
    }
    

    Also make sure that the custom FileBoxFor helper you are using generates correct name and type of the corresponding file field:

    <input name="CustomFile" type="file" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When running some tests I came across the following issue. When using: private String
I came across the following issue: private void doStuff(int i) { if(i>10) { return;
I came across the following issue: I have a main simple page on which
Writing my first PHP Class and came across an issue, the following is my
Following up on this question , I have another issue - how to get
I came across the following code : int i; for(; scanf(%s, &i);) printf(hello); As
I came across the following weird chunk of code.Imagine you have the following typedef:
I came across this post on the MSMobiles.com blog that says the following, among
While trying to model my domain, I came across the following problem. Let's image
So I came across this question ( Syntax error when creating a Rails model

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.