Is there a way to control the FileList order in Mobile Safari?

128 Views Asked by At

In React I am using this element to get multiple images:

  const onAcquirePhotos = (event) => {
    if (event.target.files && event.target.files.length) {
      console.log(event.target.files);
    }
  }

  <input type={'file'} accept={'image/jpeg'} id={'choosePhoto'} onChange={onAcquirePhotos} multiple />

The images I receive in event.target.files (the FileList object) are not in a consistent order as they are in other browsers (I want the files/images to load in by the order in which they are in the photo library). The "name" and "lastModified" fields are also not consistent. Is there something I can do here? or is this just Safari being Safari?

Edit: I added the function that gets the files. I select the same images on every attempt, but the console.log does not print them in the same order for each attempt. The goal is to get them in the order that they appear in the file system/photo library like in other browsers.

0

There are 0 best solutions below