Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBPM-9942 When try to attach a document the file can not greater tha… #2648

Merged
merged 1 commit into from May 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -324,38 +324,32 @@ function validate(start) {

var fileData = new Map();


function encodeImageFileAsURL(input) {

var filesSelected = input.files;
if (filesSelected.length > 0) {
var fileToLoad = filesSelected[0];

var fileInfo = {
'name' : fileToLoad.name,
'size' : fileToLoad.size,
'data' : null
'name': fileToLoad.name,
'size': fileToLoad.size,
'data': null
};
fileData.set(input.id, fileInfo);

var fileReader = new FileReader();

fileReader.onload = function(fileLoadedEvent) {
var local = fileLoadedEvent.target.result; // <--- data: base64
var srcData = local.replace(/^data:.*\/.*;base64,/, "");
var fileReader = new FileReader();

fileData.get(input.id).data = srcData;

console.log("Converted Base64 version is " + srcData);
}
fileReader.onload = function (event) {
if (event.target.readyState == FileReader.DONE) {
var b64 = event.target.result.replace(/^data:.+;base64,/, '');
fileData.get(input.id).data = b64;
}
};
fileReader.readAsDataURL(fileToLoad);
} else {
alert("Please select a file");
}
}

function getDocumentData(inputId) {

if (fileData.has(inputId)) {
var fileInfo = fileData.get(inputId);
var document = {
Expand Down