I have a simple form with 4 input on it.
- 2 text input
- 2 check boxes
My current view model posted to server is like the following:
public class MyViewModel {
public string FirstText { get; set; }
public string SecondText { get; set; }
public bool FirstBool { get; set; }
public bool SecondBool { get; set; }
}
This works good. I have now the requirement that when the SecondBool value is true the UI should also upload a file to the server. Then I have modified the view model to add
public HttpPostedFileBase UploadedFile { get; set; }
and modified the form to having an attribute enctype="multipart/form-data"
I would like to use, as I am using bootstrap as the base UI framework the jQuery File Upload plugin but did not get through on how to post and upload the file at the same time. I know it should be very easy to do it.
Any hint?