2

I have a content type with a file field. In a view I am trying to make the title link to the document. So that when someone clicks the title it downloads the file.

In Views for the title field I selected 'output this field as a link' and in 'link-path' I entered [field_file] which is valid.

When I click the title I get a page not found error. The requested page "/%20the%20file%20name.xlsx" could not be found.

So it seems it is treating the link as a url link. How can I change this so that it downloads the file?

4
  • A link to the file will download the file when clicked. Your problem is that the file in the url doesn't exist on your server at "/ the file name.xlsx". Does your file really have a space at the beginning of its name?
    – rooby
    Oct 16, 2013 at 13:57
  • So what can I use in the rewrite to get the absolute path of the file?
    – Dan
    Oct 16, 2013 at 14:06
  • Maybe you have the correct absolute path, but you have renamed this file after uploading, causing the error. In which directory is this file? What is its filename? Can you try uploading a better-named file, without spaces (at least at the beginning of the name)?
    – Sifro
    Oct 16, 2013 at 14:19
  • I don't have the right path. I can see that it is just putting the file name after the root as though this were a link to another page. I need a way to get the absolute path for the file.
    – Dan
    Oct 16, 2013 at 15:08

1 Answer 1

5

When you added field_file in views as a field you should set the Formatter to URL to file instead of Generic file.

0

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.