我想通过 api 在 box.net 上上传文件,并以这种方式通过发布请求发布我的文件
根据 Box.NET 的文档,这里是请求 url
https://upload.box.net/api/1.0/upload/<auth token>/<folder id>
这是文档http://developers.box.net/w/page/12923951/ApiFunction_Upload%20and%20Download
WebRequest request = WebRequest.Create("https://upload.box.net/api/1.0/upload...;
request.Method = "POST";
byte[] byteArray = File.ReadAllBytes(@"C:\a.docx");
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
我收到这条消息“upload_no_files_found”的异常