I am using DropZone.js
My configuration
Dropzone.options.myAwesomeDropzone = {
url: 'UploadImages',
previewsContainer: ".dropzone-previews",
uploadMultiple: true,
parallelUploads: 5,
maxFiles: 20,
addRemoveLinks: true,
init: function() {
this.on("success", function(file, response) {
$('.dz-progress').hide();
console.log(response);
console.log(file);
});
}
}
});
This code works fine with my localhost. I upload files to UploadImagesurl. I have entered one post in this url method which works correctly.
My problem: I do not understand what name should I use to get content on the server. Like what is the name of the imageFile variable, the imageName variable, the imageContent type, which should access my server-side implementation.
Edit:
Server-side implementation of DropZone
Dropzone does not provide a server-side file processing implementation, but the file upload method is identical to the file upload forms:
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file" />
</form>
I turned on
<input type="file" name="file" />
automatically in the form so we can access it using file
<input name="file" type="file" multiple />
, file[]
public class ImageAction extends ActionSupport {
private List<File> file;
private List<String> fileContentType;
private List<String> fileFileName;
System.out.println("Inside Image upload ");
System.out.print("\n\n---------------------------------------\n");
int i = 0;
for (File f : file) {
System.out.print("\nFile [" + i + "] ");
System.out.print(" length: " + f.length());
System.out.print(" name:" + getFileFileName().get(i));
System.out.print(" contentType: " + getFileContentType().get(i));
i++;
}
System.out.println("\n---------------------------------------\n");
}
}
.
Action.