我必须在time.create上发送多个图像--产品模型如下
product.cs:
[JsonProperty("Image")]
public List<IFormFile> Image { get; set; }
现在,我试图添加多个图像,从swagger .i进入图像路径,但它没有读取图像文件。我应该进入什么地方?
我期待着像这样的打击:
发布于 2022-11-01 14:50:04
这个示例适用于.NET 6:
public class DataTypeExample
{
public string str { get; set; }
public List<IFormFile> testFiles { get; set; }
}
[HttpPost]
public async Task<List<string>> Post([FromForm] DataTypeExample dataTypeEx)
{
var fileSizes = new List<string>();
fileSizes.Add("You sent the string: " + dataTypeEx.str);
foreach(var f in dataTypeEx.testFiles)
{
fileSizes.Add(f.FileName + ": " + f.Length.ToString() + " bytes");
}
return fileSizes;
}
结果如下:
https://stackoverflow.com/questions/57289409
复制相似问题