I am trying to send login name, password and a picture from an html5 form to asp.net mvc4 controller. I am able to get loginname and password value in that controller. How to get the picture there and save to database?
html form-
<form action="/Home/Index" id="login-form">
<input type="text" name="username">
<input type="password" name="password">
<input type="file" name="photo" accept="image/*;capture=camera">
<button type="submit">Submit</button>
</form>
jquery ajax submission-
var data = $('#login-form').serialize();
var url = $('#login-form').attr('action');
$.post(url, data, function (response) {
//some code here
}
controller-
[HttpPost]
public JsonResult Index(FormCollection data)
{
String userName = data["username"];
String userPassword = data["password"];
//I want to get that picture here
}
Please suggest.