有人知道如何使用 C# 上传到 imageshack.us 吗?这里的另外两个线程无济于事:/那是我的一段代码。“PostParamCollection”是一个用于发送 HTTP Post 的库。非常感谢您的帮助!
我收到错误消息:“抱歉,但我们检测到收到了意外数据。缺少必需的参数 'fileupload' 或您的帖子不是 multipart/form-data ”
String imageshackurl = "http://www.imageshack.us/upload_api.php?";
PostParamCollection postParamCollection = new PostParamCollection();
postParamCollection.Add(new PostParam("key", imageshack_key));
postParamCollection.Add(new PostParam("Content-Disposition", "form-data"));
postParamCollection.Add(new PostParam("filename", "a.jpg"));
postParamCollection.Add(new PostParam("Content-Type", "image/png"));
HttpPost httpPost = new HttpPost(imageshackurl);
httpPost.doPost(postParamCollection);
String link = httpPost.responseStream;
WriteLog(link);