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.
Coming from #1166168: Expose a widget for filefield and imagefield, so that media browser can be used for them and related to #1201920: Hide field and widget settings that the media widget cannot support, we need to respect filefield settings for filepath, etc, when using the widget on a filefield/imagefield.
Comment | File | Size | Author |
---|---|---|---|
#30 | 1201924-media-use_file_field_settings.patch | 6.28 KB | Dave Reid |
#28 | 1201924-28-media-use_file_field_settings.patch | 6.18 KB | becw |
Comments
Comment #1
aaron CreditAttribution: aaron commentedI set this as another issue, because it's probably slightly more difficult than the first.
Comment #2
DamienMcKennaSubscribe.
Comment #3
gusaus CreditAttribution: gusaus commentedSeems like there may be some overlap with these issues?
#1096374: Provide administrator with ability to customize upload directory, globally and per-field, with token integration
#1069582: How to use an alternate stream wrapper when saving media files?
Comment #4
dddbbb CreditAttribution: dddbbb commentedsub
Comment #5
Dave ReidProper tag
Comment #6
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedSubscribe.
Comment #7
yareckon CreditAttribution: yareckon commentedsub
Comment #8
Poieo CreditAttribution: Poieo commentedSubscribing.
Comment #9
tsvenson CreditAttribution: tsvenson commented+1 this would be very useful to have. But I hope the setting will only be used as a default, suggested, value that can be overridden by for example a media manager module or options set when uploading a new file.
Comment #10
rodrigoaguilerasub
Comment #11
tsvenson CreditAttribution: tsvenson commentedMoving this to the 2.x branch, setting backport tag.
Comment #12
screenage CreditAttribution: screenage commentedsubscribing
Comment #13
tsvenson CreditAttribution: tsvenson commentedI've come up with a sort of workaround for this using the IMCE module. Requires a bit more work, but you get the files stored where you want them at lest.
You'll find it at the end of http://www.drupalmill.com/blog/tsvenson/2011/08/08/media-module-needs-fu...
Comment #14
rodrigoaguilerasub
Comment #15
Dave ReidComment #16
Dave ReidComment #17
tribsel CreditAttribution: tribsel commented...also public/private settings should be respected, currently its not. When using browser widget, files are always uploaded to public directory
Comment #18
chiebert CreditAttribution: chiebert commentedSub
Comment #19
acbramley CreditAttribution: acbramley commentedsub
Comment #20
bochen87 CreditAttribution: bochen87 commentedsubscribe! we would be willing to help, as we especially need the directory feature for media 7.x-1.x version.
Can anyone point me where I have to do what so that media field can have directories where they are saved?
Comment #21
ParisLiakos CreditAttribution: ParisLiakos commentedSubscribe and want to help too.
some guidance on this would be appreciated
Comment #22
acbramley CreditAttribution: acbramley commentedHas there been any progress on this?
Comment #23
acbramley CreditAttribution: acbramley commented#13 worked for me but only for image files? I uploaded a PDF through IMCE but it did not show in media browser.
Comment #24
bensnyder CreditAttribution: bensnyder commentedsub
Comment #25
becw CreditAttribution: becw commentedComment #26
idiotzoo CreditAttribution: idiotzoo commentedsub
Comment #27
Dave ReidWe decided to form alter the description field out. This is better handled by fields on files.
Comment #28
becw CreditAttribution: becw commentedHere's a patch that uses the file extensions and file size from the file field instance for upload validation, and uses the file field instance file directory and file field URI scheme for saving the file.
This patch changes the parameters to
media_add_upload()
, which might be a problem--instead of providing an array of media types as the first parameter (after$form
and&$form_state
), it passes an array of parameters that includes the 'types' array. Woo, nested configuration arrays. If necessary, the parameters array could be an extra optional parameter instead.This patch may require a followup issue for dealing with previews of private files--and possible ALL media display of private files.
Comment #29
Dave ReidWe need to use some similar logic from file_field_widget_upload_validators():
Comment #30
Dave ReidComment #31
robeano CreditAttribution: robeano commentedTested successfully on 2.x and 1.x. Ran automated tests successfully as well.
Comment #32
Dave ReidCommitted #30 to Git (attributed to becw) and 7.x-1.x and 7.x-2.x.
http://drupalcode.org/project/media.git/commit/0b95bf8
http://drupalcode.org/project/media.git/commit/d18f7ae
Comment #34
stephen Piscura CreditAttribution: stephen Piscura commentedI'm sorry to re-open this issue, but it's not immediately clear to me how this commit accommodates the support request originally made here: #1096374: Provide administrator with ability to customize upload directory, globally and per-field, with token integration and in particular the need to specify a custom upload directory for files uploaded from admin/content/file, as opposed to files uploaded via a field on a node or entity. To be clear, files uploaded via the media browser widget on an image-field or file-field are respecting custom directory settings (and tokens! Whew!). But is there a means to specify a custom upload directory when using the media browser at admin/content/file, so that all files uploaded here do not live at the top level of one's public file system path?
Comment #35
muriqui CreditAttribution: muriqui commentedHey stephen... In #1243006: Uploading a textarea image to a particular folder, one of the Media maintainers (arthurf) stated that he felt this functionality was better handled by an add-on module. To that end, I've created a sandbox project called Media upload directory that provides default directories by file type, regardless of whether the media file is attached to a field.
The implementation was pretty simple (just a config form and a few lines of additional validation on upload), so I'd love it if arthurf or another Media maintainer could take a look at that sandbox and reconsider whether or not this should be included directly in Media. If yes, then I can reformulate it as a patch and post here. If not, I'll promote to a full project and maintain it separately. Thanks!
Comment #36
stephen Piscura CreditAttribution: stephen Piscura commentedMuriqui, thanks so much for your work on the upload directory module. I'm going to test it out and i'll be sure to list any findings/bugs/whatever in its issue queue. I think this kind of functionality belongs in the media module itself, simply because it resolves such a seemingly fundamental need: file organization.
Comment #37
Andrea C CreditAttribution: Andrea C commentedSubscribe
Comment #38
dddbbb CreditAttribution: dddbbb commented@Andrea C NO! Follow, don't subscribe. http://drupal.org/node/1306444
Comment #39
Dave ReidThe admin/content/file directory lacks any kind of 'field context' so if you want that type of feature you need to open a new feature request. This bug as originally reported is being marked back as fixed.
Comment #40
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedcould you use filefield_paths to get what you need?
Comment #41
Anonymous (not verified) CreditAttribution: Anonymous commentedMy experience is that when you use the Media widget on an ImageField, it respects the proper file path. However, when I use the Media WYSIWYG editor button, it does not respect it, and places it into the default "files" directory. I'm guessing this still needs to be fixed?
EDIT: Apologies, I just noticed this bug is listed for 7.x-2.x, whereas I'm using 7.x-1.x. (It's a site that I'm building for a client, so I need a stable release.) Perhaps this is the wrong place to post this then?