title: Post Text values and upload an image by Web Api 2 C#
body: <p>I'm trying to save some data to my database and uploading an image at the same time using a Web Api. </p>
  
  <p>I failed to do this because I cannot send multipart/from and JSON at the same time. I got this error:</p>
  
  <blockquote>
    <p>request entity's media type 'multipart/form-data' is not supported for this resource.</p>
  </blockquote>
  
  <p>This is my code:</p>
  
  <pre><code>public IHttpActionResult Post([FromBody]Post userpost)
  {
     Upload upload = new Upload();
     int postid = Convert.ToInt32(postDB.AddPost(userpost));                   
     var filename = postid + "_"+Guid.NewGuid().ToString();
     upload.UploadFile(filename, Request);
     return Ok(HttpStatusCode.Accepted);
  }
  
  public class Upload:IUpload
  {
      private const string Container = "images";
  
      public async Task&lt;bool&gt; UploadFile(string filename, HttpRequestMessage Request)
      {
          var accountName = ConfigurationManager.AppSettings["storage:account:name"];
  
          var accountKey = ConfigurationManager.AppSettings["storage:account:key"];
          var storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
          CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
  
          CloudBlobContainer imagesContainer = blobClient.GetContainerReference(Container);
  
          var provider = new AzureImages(imagesContainer,filename);
  
          try
          {
              await Request.Content.ReadAsMultipartAsync(provider);
          }
          catch (Exception ex)
          {
              return false;
          }
  
          if (string.IsNullOrEmpty(filename))
          {
              return false;
          }
  
          return true;
      }
  }
  }
  </code></pre>
  
  <p>I'm testing it using Postman
  Thanks in advance.</p>