title: Get binary file data sent from postman in net core web api?
body: <p>How to read the video file sent from the postman in body binary...
  Content-Type : video/mp4
  Content-Range: bytes 0-5119999/33230845
  Content-Length: 5120000</p>
  <pre><code> IFormFile file;
  
              using (var sr = new BufferedStream(Request.Body))
              {
                  var byteArray = await sr.ReadAllBytes();
                  var stream = new MemoryStream(byteArray);
                  file = new FormFile(stream, 0, byteArray.Length, &quot;testName&quot;, &quot;testFileName&quot;);
  
                  string path = $&quot;C:\\Projects\\vid{uploadRequest.BlockId}.mp4&quot;;
                  using FileStream str = new FileStream(path, FileMode.Create);
                  str.Position = 0;
                  await stream.CopyToAsync(str);
              }
  
  public static async Task&lt;byte[]&gt; ReadAllBytes(this Stream instream)
          {
              if (instream is MemoryStream)
                  return ((MemoryStream)instream).ToArray();
  
              await using MemoryStream memoryStream = new MemoryStream();
  
              await instream.CopyToAsync(memoryStream);
              return memoryStream.ToArray();
          }
  </code></pre>
  <p>When I save this file into <strong>C</strong> Disk and open it, says that: item is unplayable...</p>
  <p><a href="https://i.stack.imgur.com/1g4XF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1g4XF.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/pVrg5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pVrg5.png" alt="enter image description here" /></a></p>