Another token that could help the FileField Paths module is a [file:basename] token.

#1 1515864-file-basename-token.patch2.35 KBDave Reid
PASSED: [[SimpleTest]]: [MySQL] 323 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Dave Reid’s picture

Status: Active » Needs review
2.35 KB
PASSED: [[SimpleTest]]: [MySQL] 323 pass(es). View
Dave Reid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fmr’s picture

This token is currently (almost?) always the same as [file:name]. Please read my comment on a "bug" in bulk_media_upload, here for background info.

Is it supposed to use PATHINFO_BASENAME? Or did you mean to create a token for "filename without the extention"? For that, you need to use PATHINFO_FILENAME (available since php 5.2.0, see Or maybe the idea was to strip all file extentions? For that a custom (though simple) regex is needed.

If this works as intended, then can we regard this as a feature request for a new token, which gets replaced by only the filename (minus the last n extentions)?

jhodgdon’s picture

Note: I've repurposed #2106979: Could we have a file token that gives you the file name without extension to be a feature request for that other token.