0

I'm trying to post a simple file into my C# WEB API. Here is how it look in Postman:

Postman Screenshot

Second Postman Screenshot

This SO thread make it look easy to access the file. It seems that I only need the instruction:

var fileToUpload = HttpContext.Current.Request.Params["document"];

However when I hit the endpoint and I debug, fileToUpload is coming null.

What's wrong??

Thank you

SamyCode
  • 928
  • 3
  • 14
  • 33

1 Answers1

0

For some reason, even if it supposed to work with code HttpContext.Current.Request.Params["document"]; following this thread, it didn't work for me. What actually worked, is using HttpContext.Current.Request.Files["document"];

SamyCode
  • 928
  • 3
  • 14
  • 33