title: How to convert base64 value from a database to a stream with C#
body: <p>I have some base64 stored in a database (that are actually images) that needs to be uploaded to a third party.  I would like to upload them using memory rather than saving them as an image then posting it to a server.  Does anyone here know how to convert base64 to a stream?</p>
  
  <p>How can I change this code: </p>
  
  <p>var fileInfo = new FileInfo(fullFilePath);
  var fileContent = new StreamContent(fileInfo.OpenRead());</p>
  
  <p>to fill the StreamContent object with a base64 interpretation of an image file instead.</p>
  
  <pre><code>    private static StreamContent FileMultiPartBody(string fullFilePath)
      {
          var fileInfo = new FileInfo(fullFilePath);
  
          var fileContent = new StreamContent(fileInfo.OpenRead());
  
          // Manually wrap the string values in escaped quotes.
          fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
          {
              FileName = string.Format("\"{0}\"", fileInfo.Name),
              Name = "\"name\"",
          };
          fileContent.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
  
          return fileContent;
      }
  </code></pre>