I've got a problem when I want to download a zip file from a Rest api,
When the zip file is tranfered from my server (with jersey), I receive it corrupted, ...
I've already tried to put responseType: 'arraybuffer'
on my $http request but it isn't fixing anything... here's my code.
$http.get(uploadUrl, {
cache: false,
responseType: 'arraybuffer'
})
.success(function (data, $scope) {
var element = angular.element('<a/>');
console.debug("data : " + data);
element.attr({
href: 'data:application/octet-stream;charset=utf-8,' + encodeURI(data),
target: '_blank',
download: fileName
})[0].click();
})
.error(function () {
console.info("fail on download");
});
};