I try to submit contact information from my webpage. I am using ajax to post the form data (Name,Subject,etc.., with attachment file).
The form values of
- Name,subject,etc.., these are string type 
- Attachment file only object type 
In my first case is:
var Name =$("#Full_Name").val()
var Subject =$("#Subject").val()
var Message =$("#Message").val()
var Email =$("#Email_Address").val()
var Phone =$("#phoneNumber").val()
var userfile =$("#uploadBtn").files[0]
var Address =$("#Address").val()
var City =$("#City_Name").val()
var Pincode =$("#City_code").val()
var State =$("#State_Name").val()
var Country =$("#Country_Name").val()
the above code to post all datas correctly without userfile (attachment file )
In my second case:
I replace
var userfile =$("#uploadBtn").files[0] 
this one to
var userfile = new FormData();
$.each($('#uploadBtn')[0].files, function(i, file) {
      userfile.append('file-'+i, file);
});
after add this line for posting upload file to server
But server get the result is only the format of [object:object]
Why server get this result? How to get the form data values with upload file
My code is:
In HTML:
<form action="#" name="f" enctype="multipart/form-data" id="myform" >
In Javascript:
    $.ajax({
               async:true,
               url: "/cgi-bin/servercall_upload.cgi",
               type: "get",
               processData: false,
               contentType: false,
               traditional: true,
               data: {
                     Name:Name,
                     Subject:Subject,
                     Message:Message,
                     Email:Email,
                     Phone:Phone,
                     userfile:userfile,
                     Address:Address,
                     City:City,
                     Pincode:Pincode,
                     State:State,
                     Country:Country
               }
    });
How do I solve this Problem?
