I'm building an ASP.NET Core Web API in C#. I receive a PDF file in the request body.
When I write the bytes of the request body, I get a file having base64 string (which should be decoded to get the actual PDF).
I don't know what to do next .. please advise ..
var ms = new MemoryStream((int)Request.ContentLength);
req.CopyToAsync(ms).GetAwaiter().GetResult();
System.IO.File.WriteAllBytes("test.pdf", ms.ToArray());
When I open test.pdf
, I get something like the below:
JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBl............cnR4cmVmDQoxODkzOQ0KJSVFT0Y=