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.
By which way I can specify upload path for media field?
Comment | File | Size | Author |
---|---|---|---|
#8 | upload_path_fix-1364676-0.patch | 1.06 KB | Chi |
Comments
Comment #1
medden CreditAttribution: medden commentedGo to 'admin/config/media/file-system' and set your site wide paths there.
For MultiMedia Asset Fields
Then if you add a media field to any content types, editing that field gives you the option to save as private or public (also others like youtube / flickr if installed).
For Image Fields, I think you can specify further options such as full path / sub directory / tokens.
Comment #2
Chi CreditAttribution: Chi commentedI cannot find further options for images. I am looking for a way to specify subdirectory for images uploaded by Media module.
Comment #3
medden CreditAttribution: medden commentedI think sub directories are only available if you use the Drupal core image upload handling.
Perhaps this should be a feature request for the Media module.
Comment #4
Chi CreditAttribution: Chi commentedCan you explain me why all my images are saving in sites/default/files/null directory?
I think it's a bug.
Comment #5
Chi CreditAttribution: Chi commentedI found this code in includes/media.fields.inc
So it may be possible to specify upload path, but I cannot find a way to set $field_settings['file_directory'] variable.
Comment #6
medden CreditAttribution: medden commentedI checked, and yes it is possible to specify upload directory.
When you add a new field to your content type... select IMAGE then MULTIMEDIA ASSET
The edit field will now allow you to specify a subdirectory.
Comment #7
Chi CreditAttribution: Chi commentedWhich version of the module are you using?
Comment #8
Chi CreditAttribution: Chi commentedYou are right. I can use image or file field instead of the Multimedia assert field. These fields also supported by "Media file selector" widget. Now I've checkout 2.x version and I am seeing that this field type (Multimedia assert) is deprecated.
But nevertheless, null directory confused and I made a little patch to fix it.
Comment #9
Chi CreditAttribution: Chi commentedComment #10
Dave ReidAh! Now I see why this is happening - because JavaScript interprets 'NULL' as an actual string. Should we also be fixing max_filesize as well?
Comment #11
Dave ReidMarked #1351890: Wrong upload destination folder "null" as a duplicate of this issue.
Comment #12
Dave ReidGreat, committed #8 along with a fix for max_filesize as well to both branches.
http://drupalcode.org/project/media.git/commit/d817ae5
http://drupalcode.org/project/media.git/commit/7f8e5f4