Answer the question
In order to leave comments, you need to log in
How to unlock FileList for writing?
I understand that the collection of FileList files is read-only and cannot be edited, but in fact in our world everything is arranged in such a way that if something is impossible, but you really want to, then you can. The only question is HOW?
Perhaps there are builds of Chrome with disabled security options? Or something third?
Answer the question
In order to leave comments, you need to log in
Life hack to create a collection of FileList files :
var info = 'Какой-нибудь текст';
var dt = new DataTransfer();
dt.items.add(new File([info], 'primer.txt', {type: 'text/plain'}));
var file_list = dt.files;
console.log('Коллекция файлов создана:');
console.dir(file_list);
// Вставим созданную коллекцию в реальное поле:
document.querySelector('input[type="file"]').files = file_list;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question