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.

https://drupal.org/comment/7270018#comment-7270018

Comments

scoff’s picture

I'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.

bohemier’s picture

Trying to see how to solve this... Problem seems to be here:

MediaInternetFileHandler.inc, function postSave:

    $destination_uri = file_entity_upload_destination_uri(array());

$destination_uri is always returned as public://

Now I just have to figure out how to fetch the field parameters and parse them

bohemier’s picture

It's deeper than I thought... That comment says it all:

/**
 * Implements hook_media_internet_providers().
 *
 * Provides a very basic handler which copies files from remote sources to the
 * local files directory.
 */
function media_internet_media_internet_providers() {

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().

johsve339’s picture

Any updates regarding this issue. I also need this solution.

bohemier’s picture

We 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.

PraetorianFX’s picture

Hi, is there any solution for this issue... ? its very important for update because like has dries's tweet

Saw a Drupal site crash because Drupal stored hundreds of thousands of files in a single directory.
Maybe we should be smarter about that?

— Dries Buytaert (@Dries) November 5, 2013

Thank you

bohemier’s picture

No input from the maintainers so far... Still don't know which way is appropriate

amaisano’s picture

Any proposed solutions or patches for this would be awesome. No news?

obiwankaynobi’s picture

Opps I had an irrelevant comment. Retracting

joseph.olstad’s picture

patch #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

Chris Matthews’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.x-dev
Status: Active » Closed (outdated)

Recent 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