ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.45k stars 8.15k forks source link

🧐[问题]ProFormUploadButton上传文件,.net core怎么接收到文件 #9121

Closed bieshaoxiong closed 3 years ago

bieshaoxiong commented 3 years ago

🧐 问题描述

前端可以正常访问到后端接口,但是后端怎么接收不到文件

1631948593(1)

image

💻 示例代码

前端 : <ProFormUploadButton name="upload" label={props.uploadLabel} max={1} fieldProps={{ name: 'file', }} action="/api/ProjectManagement/products/ReceiveFile" />

后端 [HttpPost] [Route("ReceiveFile")] public AntProResultDto ReceiveFile() { var files = Request.Form.Files; var headers = Request.Headers;
var CurrentContext = HttpContext; }

🚑 其他信息

chenshuai2144 commented 3 years ago

.net 我也不会用,等社区的小伙伴帮你把

Liu-Ya commented 3 years ago

image image

Liu-Ya commented 3 years ago

image

<ProFormUploadButton name="file" fieldProps={{ name: 'file' }} action="/api/api/upload" />
bieshaoxiong commented 3 years ago

图片

< ProFormUploadButton  name = "file"  fieldProps = { {  name : 'file'  } }  action = "/api/api/upload"  / >

奇怪 image image

bieshaoxiong commented 3 years ago

还没整明白是前端写错了 还是后端写错了

Liu-Ya commented 3 years ago

https://stackoverflow.com/questions/27533317/uploading-files-using-angualrjs-and-abp-boilerplate-with-webapi

应该是后端问题

Liu-Ya commented 3 years ago

看起来跟你用的framework有关系,你得慢慢找原因了 https://stackoverflow.com/questions/46294091/how-do-you-do-file-upload-method-in-appservices-for-aspnetboilerplate