- π¬π§United Kingdom ebo1958
Hi, I hope it's OK for me to post my question here.
I've set up media directories as listed above.
I'm pretty sure I found the module through a post (which I sadly can't find anymore) where it was asked how to add media to a directory other than xxx.com/sites/default/files. When media directories was set up the folder name would replace the default directory. I was expecting xxx.com/new-directory/file-name.
What I get is xxx.com/sites/default/files/new-directory/file-name.
Would you please tell me if I have made a mistake in setting up the directories? Possibly there is another token I could use. Unfortunately, I'm not experienced enough to know what it could be.
Any help would be appreciated. - πΊπΈUnited States nixar San Antonio, TX
I have good luck using filefield_paths with this module.
I can even drag and drop documents from the browser and the path gets updated automatically.
Configuration for the file field of the Document media type:
Enable Filefield_paths?: checked
then under Field (Field) Path Settings:
File path: media-library/[media:directory:entity:parents]/[media:directory:entity:name]
File path options: check all
File name: leave unchanged
File name options: check all
Active Updating: checkedThe only caveat is that my folders can only be nested with a depth of 2 since the token [media:directory:entity:parents] can turn multiple nested terms into a flat one but I can leave with that.
- π¬π§United Kingdom ebo1958
Hello Nixar,
Thanks for your post. I tried the steps you laid out and now just wonder if I have misunderstood how the module works.The entity:name is displayed as you say but it is the path to the PDF that is still in the sites/default/files folder.
So the path I was expecting was xxx.com/media-library/new-directory/entity-name/xyz.pdf but I'm getting xxx.com/sites/default/files/media-library/new-directory/entity-name/xyz.pdf.Would you please let me know if it's possible to change the PDF path with this module. :-)
- π¨πSwitzerland ytsurk Switzerland
Drupal will always serve it's files from the sites/default/files folder!
You could change that by messing with .htaccess (if you're running on apache).