I am using ng-file-upload to send files to server.ng-file-upload worked perfectly with upload file one by one.I am using latest chrome browser.
Sample code snippet
in there files are uploaded to the server when files are selected in the file input.But what i want is that files (selected file array) should be uploaded only to the server when submit button is clicked along with other form data.
Jersey REST service
@POST
@Path("/manual")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public boolean insertResults(@FormDataParam("file") InputStream uploadedInputStream,@FormDataParam("file") FormDataContentDisposition fileDetail,@FormDataParam("username") String username) throws IOException {
System.out.println(username);
StringWriter writer = new StringWriter();
IOUtils.copy(uploadedInputStream, writer,"UTF-8");
String theString = writer.toString();
System.out.println(theString);
return Boolean.TRUE;
}
I am new to AngularJs stuff please help me to overcome this problem.