Hello Friends!
I am trying to make a list view of files that I have uploaded using the file upload component.
The goal is to be able to add drop down fields to each file in the list, allow renaming of files, and other selections/modifications prior to uploading files to end destination via an API post.
I am trying to add new files to the list view as they are added via file upload component. I have multiple files allowed and append is true.
My goal is to update a temporary variable which holds the file array as new files are added via the picker, using the change event.
It seems that the change event does not work properly when new files are uploaded. Change events seem to work if parsing is enabled and use use parsing as the event driver, but that causes my app to stall, especially when larger files are uploaded. There is a noticeable delay when updating the list view as well.
I also want to be able to delete individual files from the list view without clearing all the data and other files.
Please let me know if anyone has an idea on how to do this!
Hi @rmerchant,
Can you provide me with the json of your current app?
I believe since you are using the append feature in the fileInput, you don't have to use change events. You can add a button that will upload all files from your fileInput component's value property to your temporary variable (filesArray) after you have selected them all. This button's script will upload all files in the current fileInput component's value property, then clear the value when finished. Then you can add other files if you want. This query will look like this:
const newFiles = fileInput1.value; // gets all the selected files
const existingFiles = filesArray.value || ; // gets the current contents of the temporary value
filesArray.setValue([...existingFiles,...newFiles]) // combines all files into the temporary file
fileInput1.resetValue() // resets the file input selector to No file selected
In your list view, you can add a textInput component for the option to change the name of a file, and a delete button for each file so that you can delete that specific file from your temporary variable by writing a script to remove it from the array (using it's index).
I hope this helps! Let me know if you have other questions. 