The File (Field) Paths Module

the drupal (field) paths module is of normal difficulty to install and configure

https://www.drupal.org/project/filefield_paths

Credits & Thanks

Thank you to:

About the File (Field) Paths Module

The Drupal 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 Extend (Coffee: “extend”) or visit https://<yourDrupalSite.dev>/admin/modules.
     drupal 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 Structure > Content types (coffee: “content types) or go to https://<yourDrupalSite.dev>/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.

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

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

    drupal 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 walk through? Please tell your friends about it!

facebook icon twitter social icon linkedin social icon