2

I’m selling mp3’s via Commerce File/File Field modules and i need these files to reside in different directories based on artist name and album name, etc. For example:

mp3s/some_artist/album_name/some_song.mp3.

so typically a catalog would have numerous dirs.

but by default a Drupal content type only allows a single directory to be specified.

so far the only way to achieve this is to have to continually make changes to the product variation content type. i have to keep changing the file directory setting

this is not a good solution and limits the amount of bulk uploading i can do at one time.

is there a way to get Drupal to just accept these file references as i input it? to accept any number of different file paths, in the context of bulk import?

(i hope i’ve asked this question clearly…

1 Answer 1

4

You can define your file paths with node tokens. File (Field) Paths module provides the functionality that you are looking for.

The File (Field) Paths module extends the default functionality of Drupal's core File module, Image module and many other File upload modules, by adding the ability to use entity based tokens in destination paths and file names.

3
  • am trying to get this to work but it's not.
    – TopTomato
    Commented Jan 29, 2016 at 21:01
  • i want to do this without any file copying. i just want to create these products by referencing files that are already there.,... in dirs based on artitst name, album name
    – TopTomato
    Commented Jan 29, 2016 at 21:02
  • if it is not working for you - there can be an issue with configuration. You will have to upload your files by using field(s) in order to make Drupal take account of your file(s), or you can write a function that will store(connect) appropriate files to fields automatically on node creation/edit. Latter solution with your implementation might be quite cumbersome and prone to error.
    – oksana-c
    Commented Jan 31, 2016 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.