0

I'm building a library and it is possible to add books to website. I need to get uploaded file urls and display them in 'a' tag inside views page (not node). how can I do that?

unfortunately I can't use kpr() to find file properties I guess because it has lot's of outputs and it prevents the page from loading (var_dump does the same thing)

I also tested this function to print the file size but it failed

function MYT-HEME_file_link(&$variables) {
$file = $variables['file'];
print $file->getsize();
} 
  • have you uploaded the files as usual thought the content type? – Mohammed Shameem Oct 6 '13 at 11:35
  • @MohammedShameem yes – M a m a D Oct 6 '13 at 14:55
0

You can follow the below steps

  1. Create a Relationship of the type "File Usage: File"

  2. This will bring up additional Fields. You can add the filed called File: Path (Path) and select the above relationship.

  3. Check "Display download path instead of file storage URI" This would give you the entire path. You can use the same any where in the view.

Once you add the relationship you would get additional fields related to the file. For example if you want to print the size of the file you can use the field "File: Size" etc.

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.