Challenges when uploading multiple files on a VisualForce page –
* When you use a standard visual force component, you will need to limit the number of attachments in advance. Also, there is the ‘View’ state limit.
* Since the attachments are a child to a parent object, we would need to insert the parent object and get the id before inserting the attachments, which may require multiple clicks from the user.
We could start off by submitting the form details in the first remote call to submit the record which returns a parent id. Then the callback triggers the upload files function like below.