delete file from a variable

  • asad_90597-1307084636257779722

    asad

    5 months ago

    i have a file input with multiple attributes. on change i set a variable "files" to even.target -> get.files. it works fine. i have a dive that repeats the "files" with button "delete" . i want to remove the file that is clicked from the "files" variable. how do i do it
  • Tod-1307084637809414254

    Tod

    5 months ago

    Great energy @asad! Your continuous contribution to the toddle Community just made you advance to Community Level 8!
  • lucasg-1307086827991072798

    Lucas G

    5 months ago

    Filter the file index
  • asad_90597-1307090881878294579

    asad

    5 months ago

    i cannot seem to get it working
  • can you demonstrate
  • lucasg-1307100618015379547

    Lucas G

    5 months ago

    1307100617927561319-image.png
  • 128651941143117824-@Lucas G
    asad_90597-1307106982565642362

    asad

    5 months ago

    the problem is the files are not saved as arrays
    1307106982611914782-image.png
  • lucasg-1307112654581661767

    Lucas G

    5 months ago

    You're right in that it is not technically an array
  • fileList is 'array-like'
  • You can use Entries to make it an array
  • 1307112753059860520-image.png
  • lucasg-1307114841164484669

    Lucas G

    5 months ago

    Also, be mindful that the way you're creating previews can lead to memory leaks
  • You'll want to update it to properly handle it
  • asad_90597-1307153334335176724

    asad

    5 months ago

    i didn't get you . can you explain it a bit more if you don't mind
  • lucasg-1307156492750688379

    Lucas G

    5 months ago

    Your custom action, it will likely cause memory leaks