Skip to content

Commit

Permalink
JBPM-9942 When try to attach a document the file can not greater than…
Browse files Browse the repository at this point in the history
… 2 MB (kiegroup#2648)
  • Loading branch information
bxf12315 committed Jun 14, 2022
1 parent bc87e8d commit 4440d8d
Showing 1 changed file with 10 additions and 16 deletions.
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

0 comments on commit 4440d8d

Please sign in to comment.