title: How to upload files using IFormFile in C# Core with input type as file?
body: <p>The razor page contains the following code:</p>
  <pre><code>   &lt;form id=&quot;myForm&quot; asp-action=&quot;UpdateProfile&quot; asp-controller=&quot;Home&quot;
                data-ajax=&quot;true&quot; data-ajax-method=&quot;POST&quot; data-ajax-complete=&quot;profileupdated&quot;&gt;
     
         &lt;input type=text name=&quot;MyName&quot; value=&quot;&quot;/&gt;
         &lt;input type=&quot;file&quot; id=&quot;MyImage&quot; name=&quot;MyImage&quot; class=&quot;form-control&quot; accept=&quot;image/jpeg,image/jpg,image/png&quot;&gt;
         &lt;button type=&quot;submit&quot;&gt;Save&lt;/button&gt;
     &lt;/form&gt;
  </code></pre>
  <p>And C# contains following code:</p>
  <pre><code>    public class Profile
      {
        public string MyName {get;set;}
        public IFormFile MyImage {get;set}
      }
          
      
      public async Task&lt;IActionResult&gt; UpdateProfile(Profile model)
      {
         // here the model contains value of Name but MyImage is null
         // how can I get value of MyImage which is IFormFile Type
         
      }
  </code></pre>
  <p>The problem is that while submitting the form, in C# method, I get the value of the MyName field but MyImage is coming NULL. How can I get the image in the method?</p>
  <p>Note: The input type in HTML is type=&quot;file&quot; whereas in C#, I am using IFormFile for receiving the image so I am looking for help in this particular issue. I need a solution for IFormFile type, and not the other file types for uploading images/files.</p>