1

我一直在努力让上传文件发布工作。我得到的只是一个没有帮助的 404 not found 错误。我正在使用 C# HttpWebRequest。当我在提琴手中捕获请求时,这就是它的样子。

--

  POST https://api.box.com/2.0/files/content HTTP/1.1
  Authorization: BoxAuth api_key=APK_KEY&auth_token=AUTH_TOKEN
  Content-Type: multipart/form-data; boundary=----------------------------8cfa73fa0212bf1
  Host: api.box.com
  Content-Length: 198082


  ------------------------------8cfa73fa0212bf1

  ------------------------------8cfa73fa0212bf1
  Content-Disposition: form-data; name="folder_id";

  532901558
  ------------------------------8cfa73fa0212bf1

  ------------------------------8cfa73fa0212bf1
  Content-Disposition: form-data; name="filename"; filename="Pasha.pdf"
  Content-Type: application/pdf

  %PDF-1.5
  %����
  1 0 obj
  <</Type/Catalog/Pages 2 0 R/Lang(en-CA) /StructTreeRoot 29 0 R/MarkInfo<</Marked true>>>>
   endobj
  2 0 obj

  // rest of file data goes here ... too long to post

  ------------------------------8cfa73fa0212bf1
4

1 回答 1

0

这是您需要发送到 box.com 的请求示例

POST https://api.box.com/2.0/files/content HTTP/1.1
Authorization: BoxAuth api_key={key}&auth_token={token}
Content-Type: multipart/form-data; boundary="d174f29b-6def-47db-8519-3da38b21b398"
Host: api.box.com
Content-Length: 314
Expect: 100-continue

--d174f29b-6def-47db-8519-3da38b21b398
Content-Disposition: form-data; filename="hello.txt"; name="filename"
Content-Type: application/octet-stream

{Bytes}
--d174f29b-6def-47db-8519-3da38b21b398
Content-Disposition: form-data; name="folder_id"

0 
--d174f29b-6def-47db-8519-3da38b21b398--
于 2012-12-13T20:34:39.517 回答