1

I used this method to get a PHP array into JavaScript. The JS array now contain all file locations belonging to a Web3D model hosted on Omeka backend in the following form (when console.logging it):

["http://172.24.1.1/omeka/files/original/3/17/Hat.obj", "http://172.24.1.1/omeka/files/original/3/17/Hat_color.png", "http://172.24.1.1/omeka/files/original/3/17/Picture.JPG", "http://172.24.1.1/omeka/files/original/3/17/Source.zip", "http://172.24.1.1/omeka/files/original/3/17/Hat.obj.1.mtl"]

I want to transform the above JavaScript Array of file locations into a JavaScript FileList Object (please see WebAPI on FileList). In other words, how to cast or maybe transform an JavaScript Array into a FileList Object? The FileList Object is retrieved from an HTML input:

 <input type="file" id="files" multiple/>

I don't think anyone have asked this question before on stackoverflow, normally the question asked is the opposite process (FileList TO Array). Hope I am not wrong.

Thank you so much in advance for any suggestions and help.

HB87
  • 413
  • 7
  • 16
  • The Object that is returned by HTML input type is file. please see https://developer.mozilla.org/en-US/docs/Web/API/FileList – HB87 Feb 21 '18 at 18:36
  • Hmm ... You can't, but you can create a custom object emulating FileList. – Teemu Feb 21 '18 at 18:37
  • I would be indebted if you can provide an example of how that can be done – HB87 Feb 21 '18 at 18:40
  • It would be pretty much similar to [this](https://stackoverflow.com/a/38446348/1169519). – Teemu Feb 21 '18 at 18:40

0 Answers0