How To Accept a File POST

前端 未结 13 1418
深忆病人
深忆病人 2020-11-22 09:48

I\'m using asp.net mvc 4 webapi beta to build a rest service. I need to be able to accept POSTed images/files from client applications. Is this possible using the webapi?

相关标签:
13条回答
  • 2020-11-22 10:23

    This question has lots of good answers even for .Net Core. I was using both Frameworks the provided code samples work fine. So I won't repeat it. In my case the important thing was how to use File upload actions with Swagger like this:

    Here is my recap:

    ASP .Net WebAPI 2

    • To upload file use: MultipartFormDataStreamProvider see answers here
    • How to use it with Swagger

    .NET Core

    • To upload file use: IFormFile see answers here or MS documentation
    • How to use it with Swagger
    0 讨论(0)
提交回复
热议问题