title: Upload File to Web API
body: <p>I have the following model :</p>
  
  <pre><code>public class FileModel
  {
    public byte[] FileData{get;set;}
    public string FileName {get;set;}
  }
  </code></pre>
  
  <p>I have coded a private Web API service which my Web application consumes.
  When the user uploads files, I convert those files to a byte array, and send a <code>List&lt;FileModel&gt;</code> to my Web API from C# code (not from an HTML page, since my Web API is private from my website), which saves my file and return results.</p>
  
  <p><strong>Web API method:</strong></p>
  
  <pre><code>[HttpPost]
  public UploadFiles(List&lt;FileModel&gt; files)
  {
  // Do work
  }
  </code></pre>
  
  <p>The above code breaks if I upload many large-sized files - the code failed to serialize the large files' <code>FileModel</code>s since they exceed the max serializing length. </p>
  
  <p>How do I fix this issue?  Is there any other way to upload files to Web API without exposing it to the users? </p>