Upload a file with PUT/POST method on POSTMAN

后端 未结 2 1513
一整个雨季
一整个雨季 2021-02-14 05:33

I am trying to upload a file with POSTMAN to this url

http://localhost:3000/bucket/test/files/

And should got result in my controller there :<

相关标签:
2条回答
  • 2021-02-14 06:12

    You might be doing it right but sometimes POSTMAN does not work well. I wrote an API to accept both text and file.
    While invoking service from Postman. 1. I set Content-Type as "application/json" and Accept as "application/json".
    2. In body I pass the text and file It was not working, I tried multiple time. I shut down post man and my laptop.

    Woke up next morning hit again and it worked. Below is image of working request.

    0 讨论(0)
  • 2021-02-14 06:14

    While using Postman especially when you test file upload please ensure that,

    1. in Headers:
      • The Content-type field has been set as multipart/form-data in Headers.
    2. in Body:
      • form-data option should be remain as default.
      • Choose File option instead of text from dropdown at the right side.
      • Type File in text box where placeholder is key.

    Hope this helps!

    0 讨论(0)
提交回复
热议问题