0
votes

I am trying to upload file using postman . But it is giving me 500(Internal server error) whereas on actual UI it is working.

Can someone please guide me if there is any special parameter or header or type that needs to be added for the same?

My request body : ------WebKitFormBoundarylH8FJwGyEeVTCjmA Content-Disposition: form-data; name="id"

b7d86736-a9c3-4e07-9895-4e5b0b53972b ------WebKitFormBoundarylH8FJwGyEeVTCjmA Content-Disposition: form-data; name="entity"

Action ------WebKitFormBoundarylH8FJwGyEeVTCjmA Content-Disposition: form-data; name="siteId"

2fe552b7-53b1-4e4a-afff-3aef8fe9d05b ------WebKitFormBoundarylH8FJwGyEeVTCjmA Content-Disposition: form-data; name="Sample test file.pdf"; filename="Sample test file.pdf" Content-Type: application/pdf

1

1 Answers

0
votes

In postman, set method type to POST.

Then select Body -> form-data -> Enter your parameter name (file according to your code)

and on right side next to value column, there will be dropdown "text, file", select File. choose your image file and post it.

For rest of "text" based parameters, you can post it like normally you do with postman. Just enter parameter name and select "text" from that right side dropdown menu and enter any value for it, hit send button. Your controller method should get called.

enter image description here