4

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?

1
  • 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.
    – avpaderno
    Commented Apr 19, 2011 at 22:06

2 Answers 2

3

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!

3
  • 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
    Commented Apr 19, 2011 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
    Commented Apr 19, 2011 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.
    – avpaderno
    Commented Apr 20, 2011 at 0:05
3

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

1
  • Sweet! I subscribed to it on drupal.org, anticipating a 7.x version.
    – LandonAB
    Commented May 25, 2011 at 12:52

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.