Is there any way to change uploadMaxSize value?
Hi
Thanks for awesome editor. Is there any way to change uploadMaxSize value? Default it's 1e6 bytes. Is it possible to change this in free version?
@aslubsky have you found any solution, I am facing the same issue.
Yes, we use custom callback for handling image upload process. editor.registerCallback('image', () => {
})
Thanks for reply @aslubsky, can you provide any example where we can change the upload. i am already wrote this callback event but same issue.
this.emailEditor.editor.registerCallback('image', (file, done) => {
console.log(file);
let fileName = file.attachments[0].name;
let exten = fileName.split('.').length;
let extenstions = ['jpg', 'jpeg', 'png'];
let fileValidate = extenstions.includes(fileName.split('.')[exten - 1]);
if (file.attachments[0].size > image25MB) { // 2.5 MB
this.sharedService.showMessages('error', 'Image Upload', 'File size should not be greater than 2.5MB');
return;
} else if (fileValidate) {
let formData = new FormData();
formData.append('filesToUploads', file.attachments[0]);
formData.append('agencyId', sessionStorage.getItem('agentId'));
formData.append('fileType', (this.requestFrom == 'emailTab') ? 'CONVERSATION' : (this.requestFrom == 'composeEmailTab') ? 'EMAILTEMPLATE' : (this.requestFrom == 'sequence') ? 'SEQUENCES' : 'EMAILTEMPLATE');
console.log(file.attachments[0]);
fetch(${environment.host}file/upload-file, {
method: 'POST',
headers: {
'Accept': 'application/json'
},
body: formData
}).then((response: any) => {
// Make sure the response was valid
console.log(response);
if (response.status == 200) {
return response
} else {
this.sharedService.showMessages('error', 'Image Upload', response.statusText);
var error: any = new Error(response.statusText)
error.response = response
throw error
}
}).then(response => {
return response.json()
}).then(data => {
// Pass the URL back to Unlayer to mark this upload as completed
console.log(data);
done({ progress: 100, url: data["data"][0]["path"] })
})
} else {
this.sharedService.showMessages('error', 'Image Upload', 'Uploaded file type is not accepted');
return;
}
});