Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When multiform is not enabled, file/add invokes drupal_get_form('file_entity_add_upload'), so media_form_file_entity_add_upload_alter() alters the form and injects Media's allowed file extensions. When multiform is enabled, file/add invokes a different form; 'file_entity_add_upload_multiple'. So, the form alter hook is never called, and Media's default file extensions are never added.
Patch coming
Comment | File | Size | Author |
---|---|---|---|
#7 | File system 2013-07-18 12-00-45.jpg | 114.44 KB | gmclelland |
#5 | before-patch.jpg | 134.84 KB | gmclelland |
#5 | after-patch.jpg | 139.98 KB | gmclelland |
#5 | media-allowed_file_extensions_multiform-1894814-6.patch | 1.08 KB | gmclelland |
#1 | media-allowed_file_extensions_multiform-1894814-1.patch | 2.02 KB | mstef |
Comments
Comment #1
mstef CreditAttribution: mstef commentedHere's a simple patch. It removes media_form_file_entity_add_upload_alter() and places a switch() inside media_form_alter() that will execute the same code for either file_entity_add_upload or file_entity_add_upload_multiple.
Comment #2
kenianbei CreditAttribution: kenianbei commentedPatch seems to work for me.
Comment #3
ParisLiakos CreditAttribution: ParisLiakos commentedwhitespace detected:P
Comment #4
rooby CreditAttribution: rooby commentedA couple of minor coding standards fixes required:
Unnecessary white space.
Comments should not exceed 80 characters per line.
Comment #5
gmclelland CreditAttribution: gmclelland commentedThanks @mstef - I tested your patch and it fixed the problem for me. Without this patch, I wasn't able to upload an mp4 video. See the attached screenshots for details on what this patch does.
I rerolled the patch to fix the white space errors and the comments characters per line. I would set this to RBTC, but I will let someone else make the change.
Comment #6
mstef CreditAttribution: mstef commentedmy mistake..
Comment #7
gmclelland CreditAttribution: gmclelland commentedI could be wrong, but I think this patch is no longer needed. With the latest 2.x-devs of media and file entity you can go to admin/config/media/file-system you will see a new field for "Default allowed file extensions." File/add will use the extensions there.
Reopen if you still think this is an issue.
Comment #8
gmclelland CreditAttribution: gmclelland commentedJust for reference I think #2067283: Remove the obsolete file_extensions media variable makes the patch in #5 obsolete.
Comment #9
sheldonkreger CreditAttribution: sheldonkreger commentedAdded related issue I posted in Plupload.
#2160909: Some File Extensions Inaccessible in File Browser Window