Trello API-使用multipart / form-data时出现错误401

我正在使用此方法上传图像,但出现附件图像中显示的错误。 API文档是这本here,我正在关注这些示例here。我尝试了许多Internet上可用的方法来使用ContentType上传图像:multipart / form-data,但没有成功。有人可以帮助我找到一种使用此编码内容类型上传正确文件的方法吗?

public static string GenericPostImage(string url,Attachments at)
        {


            MultipartFormDataContent form = new MultipartFormDataContent();
            form.Add(new StringContent(at.key),"key");
            form.Add(new StringContent(at.token),"token");
            FileStream stream = File.OpenRead(at.file);
            StreamContent sc = new StreamContent(stream);
            form.Add(sc,"file");
            form.Add(new StringContent(at.mimeType),"mimeType");
            form.Add(new StringContent(at.name),"name");

            HttpClient client = new HttpClient();
            var responseData = client.PostAsync(url,form);

            return responseData.Result.ToString();
        }

Trello API-使用multipart / form-data时出现错误401

woshicch 回答:Trello API-使用multipart / form-data时出现错误401

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2866542.html

大家都在问