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.
Problem
When selecting the "Web" tab (Media Internet Sources module) in media browser, the image gets saved into the root directory of the specified scheme (public or private). If a directory is specified in the field configuration under "File Directory", that directory is ignored. When using normal Upload method, the image gets properly saved into the File Directory.
Comments
Comment #1
scoff CreditAttribution: scoff commentedI'm using file field with Media file selector and File (Field) Paths (https://drupal.org/project/filefield_paths) to move all files to users' configured subfolders. It works fine with file upload, but not with media_internet — all those fetched files go into public:// root folder.
Comment #2
bohemier CreditAttribution: bohemier commentedTrying to see how to solve this... Problem seems to be here:
MediaInternetFileHandler.inc, function postSave:
$destination_uri is always returned as public://
Now I just have to figure out how to fetch the field parameters and parse them
Comment #3
bohemier CreditAttribution: bohemier commentedIt's deeper than I thought... That comment says it all:
from media_internet.media.inc
So to make this work, we'd have to either implement a new InternetProvider or modify the existing one. What needs to be done here is to find a way to pass the parameters ($params) from the base MediaBrowserPlugin class to the abstract MediaInternetBaseHandler class so that we can have these parameters at MediaInternetFileHandler.postSave().
More specifically, in MediaBrowserInternet.view(), $this->parms contains all we need. Find a way to pass $params to media_internet_add().
Comment #4
johsve339 CreditAttribution: johsve339 commentedAny updates regarding this issue. I also need this solution.
Comment #5
bohemier CreditAttribution: bohemier commentedWe would need some input from the maintainers... Should a new MediaInternetFileHandler be created? I think not since this functionality should be part of the basic one. Also, we can either patch the code to pass the params array somehow or change the abstract MediaInternetBaseHandler class to accept and store the parameters in its constructor. The latter is a better solution IMHO but requires some deeper changes.
Comment #6
PraetorianFX CreditAttribution: PraetorianFX commentedHi, is there any solution for this issue... ? its very important for update because like has dries's tweet
Thank you
Comment #7
bohemier CreditAttribution: bohemier commentedNo input from the maintainers so far... Still don't know which way is appropriate
Comment #8
amaisano CreditAttribution: amaisano commentedAny proposed solutions or patches for this would be awesome. No news?
Comment #9
obiwankaynobi CreditAttribution: obiwankaynobi commentedOpps I had an irrelevant comment. Retracting
Comment #10
joseph.olstadpatch #30 from (link below) solves this problem. Allows specifying the upload folder. I've used this patch in combination with my own custom form hooks to force custom folder locations based on file entity type.
#2000934: Allow selection of which folder a file is to on the file/add form
Comment #11
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedRecent versions of media have resolved most of peoples concerns and is compatible with entity translation, multilingual and various advanced configurations. Due to the high volume of inactive and most often irrelevant issues we are Closing this as (outdated). If for whatever reason this issue is important to you AND you still have issues after checking the media recipe documentation, then let us know and we will review your concerns.
Otherwise, see the recipe documentation for how to configure media and for troubleshooting tips OR refer to the media_dev distribution if you want to see a working media setup.
As mentioned, feel free to make some noise in this issue if you still feel it is important to you or someone else.
Thanks,
Media team