Posting Json Object and FormData( file) to controller with parameter MVC
<p>I am tyring to create registration page. And i want users to upload image on registration. I created a action on controller with two parameters. One is model and other is HttpPostFileBase object. but i cant pass this two object at the same time. i tried a lot of approach but i cant figure it out. thanks.</p>

<p>On click register calling Register() metod.</p>

<pre><code>function Register() {


    var team = { id: $("#team").val() }
    var account =
    {
        eMailAddress: $("#eMailAddress").val(),
        userName: $("#userName").val(),
        password: $("#password").val(),
        password2: $("#password2").val(),
        firstName: $("#firstName").val(),
        lastName: $("#lastName").val(),
        gender: $("#gender").val(),
        team: team,
        birthday: $("#birthday").val(),
        phoneAreaCode: $("#phoneAreaCode").val(),
        phoneLocalNumber: $("#phoneLocalNumber").val()
    }

    var imageFile = $('#image').get(0).files[0];


    var data = new FormData();
    data.append("image", imageFile);
    data.append('account', account);

    console.log(typeof data);

    $.ajax
    ({
        url: "/Registration/Register",
        type: "POST",
        data: data,
        contentType: false,
        processData: false,
        success: function (response) {
            $("#message").hide();
            $("#message").empty();

            if (response.isSucceeded) {

                window.location.replace("/Login/Login");
            }
            else {

                $.each(response.errors, function (i, error) {
                    $("#message").append(error + "&lt;br&gt;");
                });
                $("#message").fadeIn();

            }


        }
    });
}
</code></pre>

<p>and there is Controller Action</p>

<pre><code>    [HttpPost]
    public ActionResult Register( HttpPostedFileBase image,Account account )
        {

        account.team = serviceFactory.Run&lt;GetTeamByIdResponse&gt;(x =&gt; x.GetTeamById(new GetTeamByIdRequest(account.team.id))).team;
        account.GenerateVerificationCode();

        CreateAccountRequest request = new CreateAccountRequest();
        request.account = account;
        request.image = image;
        request.server = Server;
        CreateAccountResponse response = serviceFactory.Run&lt;CreateAccountResponse&gt;(x =&gt; x.CreateAccount(request));

        if (response.isSucceeded)
        {
            //toDo

        }
        return Json(response);
    }

&lt;div class="kayit-ol-box"&gt;

            &lt;ul&gt;
                &lt;li&gt;
                    E-posta&lt;br&gt;

                    &lt;input id="eMailAddress" type="text"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Kullanıcı Adı&lt;br&gt;
                    &lt;input id="userName" type="text"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Şifre&lt;br&gt;
                    &lt;input id="password" type="password"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Şifre Tekrar&lt;br&gt;
                    &lt;input id="password2" type="password"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Ad&lt;br&gt;
                    &lt;input id="firstName" type="text"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Soyad&lt;br&gt;
                    &lt;input id="lastName" type="text"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Cinsiyet&lt;br&gt;
                    &lt;select id="gender"&gt;
                        &lt;option value="Erkek"&gt;
                            Erkek
                        &lt;/option&gt;
                        &lt;option value="Kadın"&gt;
                            Kadın
                        &lt;/option&gt;
                    &lt;/select&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Doğum Tarihi&lt;br&gt;
                    &lt;input id="birthday" type="date" value="" /&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Cep Telefonu&lt;br&gt;
                    &lt;input class="alankodu" type="number" id="phoneAreaCode" /&gt;
                    &lt;input class="telefon" id="phoneLocalNumber" type="number" step="1" min="10"&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Tuttuğunuz Takım&lt;br&gt;
                    &lt;select id="team"&gt;
                        &lt;option selected value="0"&gt;
                            Tutmuyorum
                        &lt;/option&gt;
                        @if (Model != null)
                        {
                            foreach (Team team in Model)
                            {
                                &lt;option value="@team.id"&gt;
                                    @team.name
                                &lt;/option&gt;
                            }
                        }
                    &lt;/select&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    Avatar Ekle&lt;br&gt;
                    &lt;span&gt;Maximum 700 kb (jpg, png, gif)&lt;/span&gt;&lt;br&gt;
                    &lt;input class="" id="image" name="image" type="file"&gt;

                &lt;/li&gt;
                &lt;li&gt;
                    &lt;input type="checkbox" id="izin" value="1" class="css-checkbox" checked="checked" /&gt;
                    &lt;label for="checkbox21" id="izin" class="css-label"&gt;
                        Üyelik Sözleşmesi 'ni okudum ve kabul
                        ediyorum.
                    &lt;/label&gt;
                    &lt;br&gt;
                    &lt;br&gt;
                    &lt;button class="kayit-submit" type="button" id="submit" onclick="Register()"&gt;ÜYELİĞİ TAMAMLA&lt;/button&gt;

                &lt;/li&gt;
</code></pre>

<p>i cant pass both of it. one of them always null</p>