Filename Hash Token
This module provides tokens that generate a hash from a filename. It also offers a token for a specific substring of that hash, which can be used with path-handling modules to organize uploaded files.
Introduction
The Filename Hash Token module defines tokens for a hash and a substring of a hash, generated from a filename. The substring token is especially useful when used with the File (Field) Paths module to organize files within a site's public files directory.
Dependencies
This module depends on the File module provided by Drupal core. The File (Field) Paths module can be leveraged to define directory paths using a hash substring generated by the name of an uploaded file. The Token module is helpful to provide a UI for browsing tokens.
Configuration
This module requires no configuration.
Examples of use
All examples use the filename "Example_File.txt".
Token: [file:name-hash]
Result: 2923b18d012d783db62a172af46da20f (The full hash of the filename)
Token: [file:name-hash-substring:4]
Result: 2923 (4 characters from the hash, offset by 0 characters)
Token: [file:name-hash-substring:2,3]
Result: 3b (2 characters from the hash, offset by 3 characters)
Maintainer
Current maintainer:
- Rick Hawkins (rlhawk) (https://drupal.org/u/rlhawk)
Depends on
Dependencies of the latest stable release
- file Drupal core >= 8.8.0
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.1 | Stable | 8–11 | Jan 30, 2025 |