Hi,
I ran into the following issue when installed with entity_browser and media.
I activated DropzoneJsEbWidget, so I believe the issue's going on there.
Problem/Motivation
Whenever I try to upload multiple images with an entity browser, I keep bumping into the error of "At least one valid file should be uploaded" (from the DropzoneJsEbWidget).
Steps to reproduce
* Setup Drupal
* Install Media, Entity browser, Dropzonejs
* Apply this patch for multiple uploads: https://www.drupal.org/project/dropzonejs/issues/2910167#comment-13418933
* Activate above modules + DropzoneJS entity browser widget
* Add an entity browser for multiple images
* Add a media reference field to any given content type
* Upload a couple of images
* Receive the error "At least one valid file should be uploaded"
Proposed resolution
I've discovered that the dropzonejs widget saves the temporary files as txt-files.
These files are attached to the dropzonejs handler in an array, but with all files in a comma separated list.
eg. $files = [
0 => 'file one.jpg.txt,file two.jpg.txt,...',
1 => 'file one.jpg.txt,file two.jpg.txt,...'
]
This is the reason why the array is empty, since the separate files cannot be parsed.
That's why I propose to add $file_names = explode(',', $file_names[0]);
in DropzoneJS.php (patch follows).
Remaining tasks
* Add $file_names = explode(',', $file_names[0]);
in DropzoneJS.php
* Test
* Rejoice
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3164379-1.patch | 659 bytes | blacksnipe |
Comments
Comment #2
blacksnipePromised patch.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedLooks right to me.
Comment #4
jungle"Needs tests", but I'd rather commit it.
Comment #6
jungleCommitted, thanks!
Comment #7
jungleComment #9
jungleReverted due to the bug #3171294: Cannot upload multiple files after updating version from 2.1 to 2.2
Comment #10
gwvoigtI'm also getting this error with DropzoneJS 8.x-2.4