title: I receive "This request requires buffering data to succeed" exception while CloudBlockBlob.UploadFromStream from a HttpPostedFile
body: <p>Stream Code</p>
  
  <pre><code>var httpRequest = HttpContext.Current.Request;
  if (httpRequest.Files.Count == 1)
  {
      HttpPostedFile file = httpRequest.Files[0];
  
      CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(BaseService.BlobConnection));
      CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
      CloudBlobContainer container = blobClient.GetContainerReference(documentType.Description);
      CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName);
  
      blockBlob.Properties.ContentType = file.ContentType;
      blockBlob.UploadFromStream(file.InputStream, file.ContentLength);
  }
  </code></pre>
  
  <p>I am using two files to test with the first is a docx file that is only 12.3KB and a pdf that is 1.47MB.  The docx file uploads without issue, the pdf is what generates the error.</p>
  
  <p>I have only found two items that attempt to explain what is going on and I really can't make heads or tails out of them. <a href="http://support2.microsoft.com/kb/2855735" rel="nofollow">Item 1</a> &amp; <a href="http://support2.microsoft.com/kb/908573" rel="nofollow">Item 2</a></p>
  
  <p>I was able to use the following code, using byte data to upload without error but when I attempted to download either file they are corrupted.</p>
  
  <pre><code>var httpRequest = HttpContext.Current.Request;
  if (httpRequest.Files.Count == 1)
  {
      HttpPostedFile file = httpRequest.Files[0];
      byte[] buffer = null;
      using (var binaryReader = new BinaryReader(file.InputStream))
      { buffer = binaryReader.ReadBytes(file.ContentLength); }
  
      CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(BaseService.BlobConnection));
      CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
      CloudBlobContainer container = blobClient.GetContainerReference(documentType.Description);
      CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName);
  
      blockBlob.Properties.ContentType = file.ContentType;
      blockBlob.UploadFromByteArray(buffer, 0, file.ContentLength);
  }
  </code></pre>
  
  <p>ANSWERED:
  The issue was in my Storage Connection string I had is selected to use HTTP connections instead of HTTPS (it's recommended for a reason). I'm not sure what that has to do with buffering to succeed, but it solved the issue and I'm now able to store uploaded files into blob storage.</p>