- Issue created by @asb
- 🇩🇪Germany asb
Correction:
Actually, Plupload 7.x-2.x-dev and 7.x-1.7 behave differently.
- The procedure described above (upload files a 2nd time, plupload discards one file of the batch) applies only to 7.x-1.7.
- Plupload 7.x-2.x-dev makes it completely impossible to upload image files. Though, still the same error message
I reverted back to Plupload 7.x-1.7 and the dated library in version 1.5.8 which gives me the described behaviour: first upload attempt - error message - second upload attempt - files are uploaded, but one from the batch is discarded.
- 🇪🇸Spain budalokko Girona
Most probably It won't make It work, but wanted to clarify that 7.x-2.x-dev expects a diferent version of plupload library, probably something around 2.1 or 2.3.
- 🇩🇪Germany asb
In combination with plupload-7.x-2.x-dev, I used 'Plupload 2.3.9 AGPLv3' (from https://github.com/moxiecode/plupload/archive/v2.3.9.zip). According to
./admin/reports/status
, the plupload module seems to have been happy with it (Status Report complained in combo with 1.5.8).However, I noticed that
./admin/reports/libraries
lists the libraries (both versions) as "Unregistered" (= "These libraries were found in the filesystem but there is no metadata about them", opposed to "Installed" = "These libraries are registered and installed correctly". I have no idea if that "Installed" vs. "Unregistered" status is merely cosmetic or has any functional impact, but I doubt that it is relevant to the file upload issue I am encountering (unless that is handled more strict since Drupal core 7.99). - 🇪🇸Spain budalokko Girona
This is the change in core that makes plupload fail since 7.99 -> https://www.drupal.org/node/2345695 →
The removal of this line in modules/image/image.field.inc works around the issue:
$elements[$delta]['#upload_validators']['file_validate_is_image'] = array();
The commit -> https://git.drupalcode.org/project/drupal/-/commit/fd71fedd655b76e3652fc...
Now we just need a proper fix :)
- 🇩🇪Germany asb
@budalokko: Thank you!
I removed this line of code in
./modules/image/image.field.inc
, and the error is fully gone. No more bogus error messages, no more silently discarded image files. Excellent!This applies to Plupload module 7.x-1.7 and the library in version 1.5.8.
Regarding that Drupal core issue #2345695 with status "Closed (fixed)", it simply introduced a regression affecting real data by attempting to fix a nothingburger about a fringe case. Since the broken validation routine is in Drupal core, Plupload module can not fix it or work around it, right?
- 🇭🇺Hungary fox mulder
a possible workaround without patching core:
function my_custom_module__field_widget_form_alter(&$element, &$form_state, $context) { if ($context['field']['type'] == 'image') { foreach ($element as $delta => $child) { if (isset($child['#upload_validators']['file_validate_is_image']) && is_array($child['#upload_validators']['file_validate_is_image']) && empty($child['#upload_validators']['file_validate_is_image'])) { unset($element[$delta]['#upload_validators']['file_validate_is_image']); } } } }
- 🇬🇧United Kingdom Ollie222
I've just come across this issue and the fix in #8 has sorted my problem.
I've not checked to see if there are any security issues with removing that line however the system I needed it for is internal anyway and only used by a couple of known users so it's not a problem in my case.