1
有沒有人知道如何上傳到C#與imageshack.us?其他兩個線程無法幫助:/ 這是我的一段代碼。 「PostParamCollection」是發送HTTP Post的庫。非常感謝您的幫助!上傳到Imageshack
林收到錯誤消息:「 很抱歉,但我們檢測到意外的數據接收所需的參數‘文件上傳’丟失或您的文章沒有的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);
這應該可以幫到你http://stackoverflow.com/questions/3890754/c-using-httpwebrequest-to-post-data-upload-image-using-multipart-form-data –