I have created a page that uses Angular File Upload component (https://github.com/nervgh/angular-file-upload/wiki/Module-API) however, I can't find how to get the uploaded file info to save it on disk.
I don't know what's the key name and how to save it. Here is a sample of my code if you could please help me.
app.controller('HomeController', ['$scope', 'FileUploader', function ($scope, FileUploader) {
$scope.uploadMessage = 'Arraste aqui o arquivo';
var uploader = $scope.uploader = new FileUploader( { autoUpload: true, url: '/url'});
// FILTERS
uploader.filters.push({
name: 'customFilter',
fn: function(item /*{File|FileLikeObject}*/, options) {
return this.queue.length <= 1;
}
});
// Callbacks
uploader.onAfterAddingFile = function (item) {
$scope.uploadMessage = 'Enviando arquivo ' + item.file.name.toString();
};
uploader.onCompleteItem = function(item, response, status, headers) {
};
}]);
And my servlet post function is just like this:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
The Angular component help says that there is a property called "alias" {String}: Name of the field which will contain the file, default is file. If I use request.getParameter("file") it's null.
UPDATE
I'm using @MultipartConfig annotation in my server however request.getPart is always null.