I use the upload control to send the file to JsonResult, but I also send the JSON string as the second parameter. All this is sent using Content-Type: multipart / form-data;
[HttpPost]
public JsonResult UploadDocument(HttpPostedFileBase file, DocumentViewModel model)
{ ... }
I know that MVC is able to bind directly to the viewmodel if the content type is set to application / json, but I don't think it is possible for me in this case.
Is there any way to get MVC to automatically bind my hosted json string to the model?
source
share