.net core 获取不到通过表单上传的图片

  • 同个表单里的文字信息可以顺利获取到,但是图片就不行。
    用IFormCollection和.Files[0]会说Index was out of range.;
    用IFormFile会说Object reference not set to an instance of an object.


慕无忌1623718
浏览 1306回答 1
1回答

烙印99

你的文件的编码类型是什么在你file标签上一级的form里面属性加上 enctype="multipart/form-data"
打开App,查看更多内容
随时随地看视频慕课网APP