Upload file using WebApi, ajax

后端 未结 6 1167
深忆病人
深忆病人 2020-12-06 02:39

I want to upload file using a WebApi by making an ajax call and the file will save into database. I tried the code given in the this link. Here, it is saved the received da

6条回答
  •  北海茫月
    2020-12-06 03:23

    You can't directly save file to the database.

    One of the options, apart from saving the file locally, is saving it into the memory stream and then passing it to the database. This question can give you the code example of how you can get the filename and extension and save the file into the memory: Web API: how to access multipart form values when using MultipartMemoryStreamProvider?

提交回复
热议问题