Reputation: 343
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.
Is there a way, to make the API Controller to accept both files and Complex JSON object in a single action method.
Upvotes: 0
Views: 973
Reputation: 54
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.
Upvotes: 1