vm.tempImage = new FilesCollection({
collection: tempImageCollection,
onBeforeUpload: function (file) {
if (file.size > (vm.config.maxUploadSize * 1024 * 1024)) {
return 'Please upload image, with size equal or less than ' + vm.config.maxUploadSize + 'MB';
} else if (!(/png|jpg|jpeg/i.test(file.ext))) {
return 'File with "' + file.ext + '" extension not supported, Please upload "png | jpg" file';
}
return true;
}
});
vm.tempImage.insert({
file: $input.files[0],
streams: 'dynamic',
chunkSize: 'dynamic',
onProgress: function (progress) {
$timeout(function () {
console.log('Uploaded: ' + progress + '%');
}, 0);
},
onError: function (error) {
console.log(error);
notificationService.showError(error.reason);
if (callback) {
callback();
}
}
}, true);
$input.files[0] = {
"meta": {},
"ext": "jpg",
"extension": "jpg",
"extensionWithDot": ".jpg",
"mime": "image/jpeg",
"mime-type": "image/jpeg"
}
I am getting error unexpected token <
in onError event of insert, after selection of image,
its working fine on development, issue is only on server.
I am using ostrio:files package for file upload.
Sever os : ubuntu