0

I tried to implement Webapi Action method which need to take Multipart formdata (Images and JSON Complex data). But the Json data which I am sending is coming as part of Formdata key value pairs instead of JSON and i couldn't parse it as a object.

I tried Advanced Rest client to test my API and below is sample request.

Request sample in ARC

Is there a way, to make the API Controller to accept both files and Complex JSON object in a single action method.

1 Answer 1

1

Yes, You can. For that you have to convert file into Base 64 String. And than after add that string object to your model. so that you can get your data and file in base 64 format to your controller. and for that you don't need multipart/form-data.

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

1 Comment

This is an API exposed, ant the client would use a tool like ARC, to send file and JSON data together as shown in above screen shot. I afraid, that i can't use the solution you proposed..

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.