flurl post请求上传文件

https://stackoverflow.com/questions/41042591/how-can-i-upload-a-file-and-form-data-using-flurl
https://github.com/tmenier/Flurl/issues/113

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));           

你可能感兴趣的:(dotnet,c#,dotnet,flurl)