By which way I can specify upload path for media field?

CommentFileSizeAuthor
#8 upload_path_fix-1364676-0.patch1.06 KBChi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

medden’s picture

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

Chi’s picture

For Image Fields, I think you can specify further options such as full path / sub directory / tokens.

I cannot find further options for images. I am looking for a way to specify subdirectory for images uploaded by Media module.

medden’s picture

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

Chi’s picture

Category: support » bug

Can you explain me why all my images are saving in sites/default/files/null directory?
I think it's a bug.

Chi’s picture

I found this code in includes/media.fields.inc

'file_directory' => isset($field_settings['file_directory']) ? $field_settings['file_directory'] : NULL,

So it may be possible to specify upload path, but I cannot find a way to set $field_settings['file_directory'] variable.

medden’s picture

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

Chi’s picture

Which version of the module are you using?

Chi’s picture

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

Chi’s picture

Status: Active » Needs review
Dave Reid’s picture

Ah! Now I see why this is happening - because JavaScript interprets 'NULL' as an actual string. Should we also be fixing max_filesize as well?

Dave Reid’s picture

Title: Upload path » Files uploaded into a 'null' directory

Marked #1351890: Wrong upload destination folder "null" as a duplicate of this issue.

Dave Reid’s picture

Status: Needs review » Fixed

Great, 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

Status: Fixed » Closed (fixed)

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