Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

The File (Field) Paths Module

Parent Feed: 
easy file (field) paths module install and configuration



Credits & Thanks

Thank you to:

About the File (Field) Paths Module

The File (Field) Paths module extends the default functionality of the Drupal core File module. That is, it allows you to automatically sort and rename your uploaded files using token based replacement patterns to maintain a nice clean filesystem.

We like to use it to make sure all uploaded files (especially images) get renamed to something similar to the node title in which it's used. Not only does this help with SEO, it makes it easier to find the files within the file system.

Install and Enable the File (Field) Paths Module

Install the File (Field) Paths module on your server. (Go here for more instructions on installing modules.)

  1. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit https:///admin/modules.
     file field paths installation
  2. Select the checkbox next to File (Field) Paths and click the Install button at the bottom of the page.

There are no separate permissions required for the File (Field) Paths module.

Configure the File (Field) Paths module

The File (Field) Paths module needs to be configured for each content type that uses file fields that you wish to use.

  1. Go to the Content types page by clicking on Manage > Structure > Content types (coffee: “content types) or go to https:///admin/structure/types.
  2. Next to the first content type, select Manage fields from the Operations drop down selection box. This will take you to the Manage fields page for that content type.

    file field paths manage fields

  3. Find the Image field and click the Edit button for that field. This will take you to the Image settings for that content type.

    file field paths image field type configuration

  4. Scroll down to the File (Field) Path Settings section, and expand it using the drop down arrow next to the heading.

    file field paths configuration settings

  5. Leave the File path field at its current default or, if empty, set it to [node:title].
  6. Expand the File Path Options section and make sure to select the following checkboxes:
    • Remove slashes (/) from tokens
    • Cleanup using Pathauto
    • Transliterate
  7. Leave the File name field at its current default.
  8. Expand the File Name Options section and make sure to select the following checkboxes:
    • Remove slashes (/) from tokens
    • Cleanup using Pathauto
    • Transliterate
  9. Select the Create Redirect checkbox.
  10. Select the Enable Alt field checkbox.
  11. [Optional] Select the Alt field required checkbox. This will remind content creators to add an alt field for this image.
  12. Scroll to the bottom of the page and click the Save settings button.
  13. If there are any additional Image Field types within this Content Type, complete steps 3-10 for them.
  14. Complete steps 1-11 for all content types. If a content type does not have an image field, then move to the next content type.

Did you like this walkthrough? Please tell your friends about it!

facebook icon twitter social icon linkedin social icon

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web