1

I'm using the flow.js library for file uploads in a project.

I'm confused about the parameter files received by filesAdded and filesSubmitted events. Would the parameter always contain files corresponding to a particular directory on disk (in case of directory uploads) and a single file (in case of file uploads) or can it contain files from seemingly unrelated uploads as well?

To give you an example, consider the scenario where a user adds two files in sequential fashion. Can the filesAdded and filesSubmitted events be triggered with the files parameter containing both these files even when they were part of unrelated uploads?

The problem arises when you have multiple upload sections on a page, and you use a single instance of Flow to handle all uploads. In this case, if files uploaded on distinct upload sections appear together in events like filesAdded or filesSubmitted, then it mixes up your files belonging to separate upload actions. One solution is creating a new Flow instance for every upload section on a page, but I wanted to understand the behavior filesAdded and filesSubmitted and whether the behavior would permit one to solve the problem using just one Flow instance.

Bharat Khatri
  • 1,367
  • 2
  • 16
  • 27

0 Answers0