我有BOX帐户和API文档
卷曲https://upload.box.com/api/2.0/files/content \ -H“授权:持票人ACCESS_TOKEN” -F filename = @ FILE_NAME \ -F parent_id = PARENT_FOLDER_ID
我坚持使用此文件名,而parent_id如何传递文件名和parent_id
我尝试过很多方法,但没有什么对我有用。
以下是代码:
httpWReq.Method = "POST";
httpWReq.Headers.Add("Authorization", "Bearer ");
httpWReq.ContentType = "multipart/form-data";
//{\"parent_id\":\""+parentID +"\"}
//byte[] file = File.ReadAllBytes(postData);
httpWReq.ContentLength = data.Length;
using (Stream reqStream = httpWReq.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
//reqStream.Close();
}
using (HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse())
{
//Console.WriteLine("HTTP/{0} {1} {2}", response.ProtocolVersion, (int)response.StatusCode, response.StatusDescription);
response.Close();
}
需要帮助
先谢谢
答案 0 :(得分:0)
Vaibhav,
请参阅官方Box C#SDK如何上传的示例: https://github.com/box/box-windows-sdk-v2/blob/master/Box.V2/Managers/BoxFilesManager.cs
你有什么理由不想使用Box Windows SDK吗?