使用 Postman 上传文件测试

Dan*_*nny 1 sharepoint-online postman

我正在使用 Postman 测试在线上传到 SharePoint 的文件。在我的 post 请求中,我将 body 设置为 form-data 并添加一个带有名为 a.txt 的文本文件的文件参数。文本文件包含文本

one
two
three
Run Code Online (Sandbox Code Playgroud)

当我执行请求时,我的文件已上传,但是当我打开文件时,内容是

----------------------------235004993628819232914336
Content-Disposition: form-data; name="file"; filename="a.txt"
Content-Type: text/plain

one
two
three
----------------------------235004
Run Code Online (Sandbox Code Playgroud)

我尝试将 Content-Type 标头设置为

application/x-www-form-urlencoded 或 multipart/form-data

但没有运气

Sob*_*rma 7

请按照以下步骤操作-

1. Go to the body of the API
2. pass the parameter or key
3. When you pass the key you have a option of value of Text/File like below
4.Choose the file from
5. Click on send.
6. Get your response.
Run Code Online (Sandbox Code Playgroud)

希望这对朋友有帮助。

在此处输入图片说明