Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有人有一个使用 C# 中的 HttpWebRequest 将文件从本地驱动器提交到 multipart/form-data Web 表单的工作示例?
使用 WebClient 更容易做到这一点
string url = "http://myserver/myapp/upload.aspx"; string file = "c:\\files\\test.jpg"; WebClient wc = new WebClient(); wc.UploadFile(url,"post",file);
如果它需要是 httpwebrequest 我可以为你整理一些东西(这是可能的),但它更像是 50 行然后 5