title: .NET MVC Web API Upload file to local storage and data model to database
body: <p>I want to upload a file and pass the model with it. But when I try it from postman, it Always bring error.</p>
  
  <p>Here is my code</p>
  
  <pre><code>public async Task&lt;IHttpActionResult&gt; PostArPumPd([FromBody] tx_arPumPd pum)
      {          
          try
            {
              if (pum == null)
              {
                  return Content(HttpStatusCode.BadRequest, "Enter the data correctly");
              }
              else
              {
              tx_arPumPd arpumpds = new tx_arPumPd()
              {
                  doc_no = doc,
                  doc_date = DateTime.Now,
                  descs = pum.descs,
                  currency_code = pum.currency_code,
                  amount = pum.amount,
                  employee_code = pum.employee_code,
                  head_code = pum.head_code,
                  company_code = pum.company_code,
                  created_by = pum.emp_code,
                  created_date = DateTime.Now
              };
              db.tx_arPumPd.Add(arpumpds);
  
              var multiFormDataStreamProvider = new MultiFileUploadProvider(Constants.MEDIA_PATH);                   
  
              var mod = "PP";
              var newFileName = mod + "_" + doc;
  
              await Request.Content.ReadAsMultipartAsync(multiFormDataStreamProvider);
  
              try
              {
                  await FileHelper.Upload(multiFormDataStreamProvider, mod, newFileName);
                  db.SaveChanges();
                  return Content(HttpStatusCode.Created, "Data was save");
              }
              catch (Exception ex)
              {
                  return Content(HttpStatusCode.BadRequest, ex);
              }                    
          }
      }
      catch (Exception ex)
      {
          return Content(HttpStatusCode.BadRequest, ex);
      }
  }
  </code></pre>
  
  <p>I get an Error while i get to this part
  await Request.Content.ReadAsMultipartAsync(multiFormDataStreamProvider);</p>
  
  <p>This is the error</p>
  
  <blockquote>
    <p>ioexception: unexpected end of mime multipart stream. mime multipart
    message is not complete test with postman</p>
  </blockquote>
  
  <p>Is there anyone who know why? And Help me to upload file and the data model?
  Thank you very much for your help</p>