-1
(function() {
var fileCatcher = document.getElementById('file-catcher');
var fileInput = document.getElementById('file-input');
var fileListDisplay = document.getElementById('file-list-display');
var arquivos_b64 = [];
var fileList = [],
renderFileList, sendFile, compactar;
fileInput.addEventListener('change', function(evnt) {
fileList = [];
for (var i = 0; i < fileInput.files.length; i++) {
fileList.push(fileInput.files[i]);
}
renderFileList();
});
renderFileList = function() {
arquivos_b64 = [];
fileList.forEach(function(file) {
var reader = new FileReader();
reader.onloadend = function() {
var b64 = reader.result.replace(/^data:.+;base64,/, '');
arquivos_b64.push(b64);
console.log(arquivos_b64);
};
reader.readAsDataURL(file);
});
console.log(arquivos_b64);
document.getElementById('anxUpload').value = arquivos_b64;
};
})();
<meta name="robots" content="noindex">
<input id='file-input' type='file' multiple />
<div id='file-list-display'></div>
<textarea id="anxUpload" name="anxUpload" class="form-control"></textarea>
Sensational!! It worked!! Thanks!!
– gabriel.b.sp