Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aaron’s picture

Issue tags: +Release blocker

I set this as another issue, because it's probably slightly more difficult than the first.

DamienMcKenna’s picture

Subscribe.

dddbbb’s picture

sub

Dave Reid’s picture

Proper tag

Niklas Fiekas’s picture

Subscribe.

yareckon’s picture

sub

Poieo’s picture

Subscribing.

tsvenson’s picture

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

rodrigoaguilera’s picture

sub

tsvenson’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Moving this to the 2.x branch, setting backport tag.

screenage’s picture

subscribing

tsvenson’s picture

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

rodrigoaguilera’s picture

sub

Dave Reid’s picture

Title: Respect filefield settings for filepath » Respect file field settings in file_field_instance_settings_form (directory, extensions, file size, description field)
Dave Reid’s picture

Title: Respect file field settings in file_field_instance_settings_form (directory, extensions, file size, description field) » Widget does not respect settings in file_field_instance_settings_form (directory, extensions, file size, description field)
tribsel’s picture

...also public/private settings should be respected, currently its not. When using browser widget, files are always uploaded to public directory

chiebert’s picture

Sub

acbramley’s picture

sub

bochen87’s picture

subscribe! 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?

ParisLiakos’s picture

Subscribe and want to help too.
some guidance on this would be appreciated

acbramley’s picture

Has there been any progress on this?

acbramley’s picture

#13 worked for me but only for image files? I uploaded a PDF through IMCE but it did not show in media browser.

bensnyder’s picture

sub

becw’s picture

Assigned: Unassigned » becw
idiotzoo’s picture

sub

Dave Reid’s picture

Title: Widget does not respect settings in file_field_instance_settings_form (directory, extensions, file size, description field) » Widget does not respect settings in file_field_instance_settings_form (uri scheme, directory, extensions, file size)

We decided to form alter the description field out. This is better handled by fields on files.

becw’s picture

Assigned: becw » Unassigned
Status: Active » Needs review
FileSize
6.18 KB

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

Dave Reid’s picture

Status: Needs review » Needs work

We need to use some similar logic from file_field_widget_upload_validators():

  // Cap the upload size according to the PHP limit.
  $max_filesize = parse_size(file_upload_max_size());
  if (!empty($instance['settings']['max_filesize']) && parse_size($instance['settings']['max_filesize']) < $max_filesize) {
    $max_filesize = parse_size($instance['settings']['max_filesize']);
  }
Dave Reid’s picture

Status: Needs work » Needs review
FileSize
6.28 KB
robeano’s picture

Status: Needs review » Reviewed & tested by the community

Tested successfully on 2.x and 1.x. Ran automated tests successfully as well.

Dave Reid’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

stephen Piscura’s picture

Status: Closed (fixed) » Active

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

muriqui’s picture

Hey 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!

stephen Piscura’s picture

Muriqui, 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.

Andrea C’s picture

Subscribe

dddbbb’s picture

@Andrea C NO! Follow, don't subscribe. http://drupal.org/node/1306444

Dave Reid’s picture

Status: Active » Closed (fixed)

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

SocialNicheGuru’s picture

could you use filefield_paths to get what you need?

Anonymous’s picture

My 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?