I am using ng-file-upload to select multiple files.But my requirement is that i want to attach those selected files as a file list into my Js object and send this object to server through REST.So far my data inserting part is working fine with out file list.
REST Service Code Snippet
@POST
@Path("/manual")
@Produces(MediaType.APPLICATION_JSON)
public boolean insertResults(testVO testResult) {
for(Object o:testVO.getFiles()){
//File access code goes here
}
}
testVO.Java class
private String fName;
private String lName;
private Object[] files;
... getter and setter methods goes here
JsFiddle HTML form
Angular Js code snippet for insert form data
$scope.insertResults= function(tc){
var result = {};
result.lName= tc.lName;
result.fName= tc.fName;
result.files=$scope.files; //This also works but i can not access file content
Service.ManualResult.insertResults({},result)
.$promise.then(function(data){
//succes code goes here
},function(error) {
//error
}
};
my requirement is that how can i send list of files along with the form data and access each uploaded files details in server side.
Note: when i call testVO.getFiles() from server side i should be able to access files attached to each request.