Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript create file list object from list of files [duplicate]

Tags:

javascript

I have a list of file object like:

var files = [File, File, File]

I want to convert it to something like:

I have a file field where I want to map my files as FileList object.

var uploading_files = {}
files.forEach(function(file, key) {
    uploading_files[key] = file

})
var uploader = document.getElementById('uploader')
uploader.files = uploading_files

console.log(uploader.files)

But It does not give me FileList object ? How can I create a file list objecdt ? Thanks in advance..

like image 213
varad Avatar asked Jul 19 '16 04:07

varad


1 Answers

The FileList object is "read-only" and has no implementation of its constructor.

Visit this page: FileList On MDN

like image 148
Timur Gilauri Avatar answered Sep 19 '22 00:09

Timur Gilauri