Upload file in WPF application using a web api whi

2019-07-18 20:39发布

I need to upload a file to server from a wpf application, the file path would be same always, so it would be simple if web api expected file path only.

But the web api method looks like this:

 // POST api/values
 [HttpPost]
 public IActionResult UploadFile(IFormFile file)
 {
    // Upload logic goes here.
 }

So I am not sure how to create an object of type IFormFile from the file path which I have.

Note: IFormFile interface is there in Microsoft.AspNet.Http namespace.

0条回答
登录 后发表回答