I need to upload file within multiple objects. I am able to upload single file or multiple file using form data.
Below sample is working fine.
var form_data = new FormData();
form_data.Append("test","test")
form_data.Append("test","test")
form_data.Append("file",file)
form_data.Append("file1",file1)
My issue is that how to upload data like this.
var obj = {
"field1":"test",
"field2","test",
"childObj": [
{"filed1:"test","field2":"test","file":file},
{"filed1:"test","field2":"test","file":file},
{"filed1:"test","field2":"test","file":file}
}]
}
here child object is dynamically added using jQuery. so it is n number of children and every child contains one file that will be uploaded by HTML input tag file.
I want to upload this JSON data using Ajax.