[Feature] Forced index for storeAsFile inputs
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe.
I'm using the reorder feature to drag my images in order and this works perfectly, the 'problem' occurs when im trying to save this order of images. The initial images will be posted with a hidden input and their indentifier as the value and the files get send through a file input. On the PHP side we would have to retrieve these values in 2 different ways, the $_POST for the initial file identifiers and the $_FILES for any extra uploaded files. Now these 2 properties have their own index, so the order we set in the filepond instance is lost.
Describe the solution you'd like
I seems like we could easily solve this by forcing the index for each input based on their rank, so instead of this:
<fieldset class="filepond--data">
<input type="hidden" name="images[]" value="3">
<input type="file" name="images[]">
<input type="hidden" name="images[]" value="4">
</fieldset>it will become:
<fieldset class="filepond--data">
<input type="hidden" name="images[0]" value="3">
<input type="file" name="images[1]">
<input type="hidden" name="images[2]" value="4">
</fieldset>Then we can easily merge the $_POST and $_FILES without problems because they have their own indexes.
Describe alternatives you've considered
The alternatives would be keeping track of these kind of values through their own hidden input. So we send an input array for the order of the files. I dont like this because then there are also other things we should keep track of that the solutation above would prevent. For example, if certain files are deleted.
Source: pqina/filepond