Im using Drupal 6 with Audio.

I have created a view that shows a list of files to download and play. There are two fields which both show the download link. I would like to change the second download link field so that it strips all the info and only prints the filename from the url contained in its content. So instead of

<*a href-"file/path/music20.mp3">Download <a*>

I would like to see




Thanks in advance

  • Do you mean you want <a href-"file/path/music20.mp3">music20.mp3</a> ?
    – Sithu
    Feb 8, 2013 at 9:01
  • ^? He means he only wants the file name shown. It has been a while since I used D6, But try looking at the options for the field. If it is a file field it may have an option to only show the file name, or you might have to uncheck a checkbox for link to content.
    – 2pha
    Feb 8, 2013 at 9:10
  • Yes I want the filename shown. I am using Views to create that list and there are no options for filename for Audio items. I was thinking that maybe there is a way of preprocessing via the template file and using php basename to pull the filename. Possible?
    – kingsmen
    Feb 8, 2013 at 9:17

1 Answer 1


In drupal 7, views 3 if you add a relationship File Usage: File you get some new fields you can add to your view, including the filename. The filename includes the extension (.doc, .pdf etc). But even with that you could theme the specific field with a template where you could easily use php to cut the .mp3 part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.