I have created a custom content type that has a file field. When I upload a file the node displays the complete file name, test_file.pdf. I would rather display its file name as clickable link. I have tried manage display and set the format to URL to file and it displays "File: site_name.com/sites/default/files/test.txt," which is only text.

Is there anything I am missing?

  • Are you using the development snapshot of Drupal 7? I am using Drupal 7, but for a file field I can only select "File," as widget. – kiamlaluno Apr 19 '11 at 22:06

You are on the right track! Go to "Manage Display" and set the format to "Generic File", it will give you a clickable filename with a link to the file!

| improve this answer | |
  • I am using that now and it's ok but I am looking for 'cleaner' look where the node displays the field label "File" and a link like "Download" rather than the file name, file.txt for example. Hope I am being clear with what I am trying to accomplish. Thanks! – LandonAB Apr 19 '11 at 18:41
  • Ok now I see, as far as I know you can't do that out of the box. You can either create a new formatter (probably kinda complicated) or just override the template for that kind of node (either using contemplate or plain .tpl.php) – Alex Weber Apr 19 '11 at 19:39
  • @LandonAB Under the arrow to down vote, there is a check mark. I cannot see it in this question, as it has been asked by you, but that is the place where to look at. You should see something like this. – kiamlaluno Apr 20 '11 at 0:05

I've created a module on drupal.org that provides a formatter that does just that: https://www.drupal.org/project/file_formatters.

| improve this answer | |
  • Sweet! I subscribed to it on drupal.org, anticipating a 7.x version. – LandonAB May 25 '11 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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