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.
Current the list of allowed extensions on file/add/upload are the more restricted set allowed by file_save_upload(). We should alter in the media__file_extensions variable.
Comments
Comment #1
Dave ReidI think just doing this might be the trick:
Not sure about this vs using a form_alter though.
Comment #2
Dave ReidLooking at http://drupalcode.org/project/media.git/commitdiff/453fad5368c86a89c2baa..., it appears we also lost support for media_variable_get('max_filesize') as well.
Comment #3
Dave ReidThis is now fixed for the extension list with http://drupalcode.org/project/media.git/commit/2666215 in 7.x-2.x.
Comment #4
Ralf Eisler CreditAttribution: Ralf Eisler commentedfile/add/upload in 7.x-2.0-unstable5+1-dev still does not match the allowed file extensions from the media browser settings and is only allowing file extensions from file_save_upload().
Comment #5
Dave ReidMake sure to update both Media and File entity to their latest versions.
Comment #6
Ralf Eisler CreditAttribution: Ralf Eisler commentedOkay, I changed File entity from 7.x-2.0-unstable5 to 7.x-2.x-dev.
Under the upload form file/add I still get "Files must be less than 8 MB. Allowed file types: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp."
Now, the files for a single or a multiple uplodad can be selected and they appear in the upload form. When I click Start upload the upload is indicated with the green upload bar. After the upload seems to be completed, I get the message "Only files with the following extensions are allowed: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp." –– And the files aren’t uploded.
Comment #7
bensnyder CreditAttribution: bensnyder commentedI can upload images from a wysiwyg and an image field with media widget, but I cant upload from /file/add. Using latest file_entity and media 2.x devs.
Comment #8
bensnyder CreditAttribution: bensnyder commentedDave -- I'm checking apache error logs and drupal's logs but can't find the root of the problem. Do you have any suggestions for testing this? I can't upload anything from file/add.
It's supposed to be adding the image to /sites/default/files/media but it's uploading to /sites/default/files/. Odd...
Comment #9
bensnyder CreditAttribution: bensnyder commentedAlso, the file never actually gets uploaded.
Comment #10
Dave Reid@bensnyder: Did you actually hit 'Submit' on that form after upload? Also, uploading on file/add will only upload to your site's root file directory since you're not uploading as a field which has a configured upload sub-directory.
Comment #11
bensnyder CreditAttribution: bensnyder commentedDave -- lol yes I hit submit :)
Here's some new stuff from the event logger:
Comment #12
bensnyder CreditAttribution: bensnyder commentedHere is the contents of http://[site]/file/ajax/upload/form-P6FHX3QMI-6fOgcUDczumNxAf_U3B4mbF49-0Kr0woQ:
Comment #13
Dave ReidHrm, I'm thinking that the server permissions are not properly set on your public files directory, ensuring that the web server can actually write to it, if drupal_chmod() is failing (which is where that error comes from). I think we need to move this to a separate issue since the problem isn't actually that we can't upload files, it's that permissions aren't set correctly, which is unrelated to being able to use this form.
Comment #14
bensnyder CreditAttribution: bensnyder commentedDave - thanks for the reply. It can't be file system permissions... I know for sure I have that set correctly. I'm doing more digging tonight - I'll post back my findings. Thanks!
Comment #15
bensnyder CreditAttribution: bensnyder commentedFinally found a [temporary] fix!
http://drupal.org/node/1337684#comment-5241598
Thoughts, anyone?
Comment #16
acbramley CreditAttribution: acbramley commentedA similar form_alter hook is required for the file_entity_add_upload_multiple as well, see http://drupal.org/node/1599892#comment-6461000
Comment #17
gmclelland CreditAttribution: gmclelland commentedThis could be related to #1894814: Allowed file extensions not set on file/add when multiform is enabled
Test the patch at #1894814-5: Allowed file extensions not set on file/add when multiform is enabled and see if it works for you.
Comment #19
joseph.olstadFixed, and issues marked as related have been fixed.
Thanks to @Dave Reid , and others.
Comment #22
gisleRemoved contents from spam attachments.