Skip to content
Advertisement

Filepond: how to configure filepond to have more than 1 filepond field in the same form?

I want to have 2 different file upload field in a form and use filepond to manage image upload nicely. I could use filepond without problems with one single field in a form so far, using the code provided by the documentation.

I assumed I could put more than one field with the following changes:

  • renaming the input from filepond to filepond_one and filepond_two
  • adjusting the document.querySelector(‘input[type=”file”]’); to querySelectorAll

Code:

JavaScript

The change applies the filepond style correctly to both inputs, however changing the name of the input seems to break the upload.

Advertisement

Answer

Digging into the filepond folder, I saw this in the config.php file:

JavaScript

So I added the field names I wanted to use as such et “voila” !

JavaScript

Hope this helps others as I got stuck on this for a day 🙂

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement