【发布时间】:2021-09-07 00:43:22
【问题描述】:
我有一个这样定义的端点:
[HttpPost]
public async Task<ActionResult> Post( ... [FromForm] IFormFileCollection images) { }
使用 PostMultipartAsync 发布对于单个流效果很好,但我如何将它用于流列表?
【问题讨论】:
标签: asp.net-core flurl
我有一个这样定义的端点:
[HttpPost]
public async Task<ActionResult> Post( ... [FromForm] IFormFileCollection images) { }
使用 PostMultipartAsync 发布对于单个流效果很好,但我如何将它用于流列表?
【问题讨论】:
标签: asp.net-core flurl
你说的是流列表的上传部分吗?有一个example来自
这个问题,基本上说明了所有的可能性:
var resp = await "http://api.com"
.PostMultipartAsync(mp => mp
.AddString("name", "hello!") // individual string
.AddStringParts(new {a = 1, b = 2}) // multiple strings
.AddFile("file1", path1) // local file path
.AddFile("file2", stream, "foo.txt") // file stream
.AddJson("json", new { foo = "x" }) // json
.AddUrlEncoded("urlEnc", new { bar = "y" }) // URL-encoded
.Add(content)); // any HttpContent
【讨论】: