I have an ASP.NET c# page that will post information of form with AJAX in JSON format.
This information includes text of Texboxes and values of Dropdownlists and etc.
Also i need to send a file too.
I have tried the following code and it works fine:
                $(".popup-content input:text,.popup-content textarea").each(function () { // Fill object by inputs
                    objInputs[$(this).attr("name")] = $(this).val();
                });
                $.ajax({ //Post information
                    type: "POST",
                    url: "myAjax.aspx",
                    data: { func: "Create", information: JSON.stringify(objInputs) /* Convert object to JSON string */ },
                    success: function (data) { // if sending was successful try to send file
                                var files = $("#fileImage").get(0).files; //get files form uploadfile
                                if (files.length > 0) {
                                    var data = new FormData();
                                    data.append(files[0].filename, files[0]);
                                    $.ajax({ //Send file
                                        type: "POST",
                                        url: "Handler1.ashx",
                                        contentType: false,
                                        processData: false,
                                        data: data,
                                        success: function (data) {
                                        },
                                        error: function (xhr, ajaxOptions, thrownError) {
                                            alert(xhr.status + " " + thrownError);
                                        },
                                    });
                             }
                    },
                    error: function (xhr, ajaxOptions, thrownError) {
                        alert(xhr.status + " " + thrownError);
                    },
                });
But now i want to know if there is a way to send my file along with my JSON?
