Upload file test with Postman

半世苍凉 提交于 2019-12-11 07:58:29

问题


I am testing a file upload to SharePoint online with Postman. In my post request I set the body to form-data and add a file param with a text file called a.txt. The text file contains the text

one
two
three

When I execute the request my file is uploaded but when I open the file the contents is

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

one
two
three
----------------------------235004

I have tried setting the Content-Type header to

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

But no luck


回答1:


Please follow the below steps-

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.

Hope this helps buddy.




回答2:


In my case setting the body to type binary solved my problem with testing with Postman



来源:https://stackoverflow.com/questions/53519207/upload-file-test-with-postman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!