[HttpPost("api/QualificationOne/Upload")]
public ActionResult Upload(IFormCollection Files, int EntId, int CrtUser)
{
try
{
//var form = Request.Form;//直接从表单里面获取文件名不需要参数
string dd= Files["File"];
var form = Files;//定义接收类型的参数
Hashtable hash = new Hashtable();
IFormFileCollection cols = Request.Form.Files;
if (cols == null || cols.Count == 0)
{
return Json(new { status = -1, message = "没有上传文件", data = hash });
}
foreach (IFormFile file in cols)
{
//定义图片数组后缀格式
string[] LimitPictureType = { ".JPG", ".JPEG", ".GIF", ".PNG", ".BMP" };
//获取图片后缀是否存在数组中
.net core webapi 上传图片
最新推荐文章于 2024-04-26 10:06:57 发布
![](https://img-home.csdnimg.cn/images/20240709112858.png)