2

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 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

You will probably also need to set a content-type header. I.e.: Content-Type:image/jpeg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.