8

After reading and searching through related topics, I have not seen any clear answer about how to show the file size in a Views created file list. Im using Drupal 7 and having File 7.14 field installed.

I was expecting to select a field in Views in order to show it as a third column in a list of files that can be downloaded (after Title and File).

I am not a programmer, and the only related issues I've seen so far is about editing php files.

Currently, as administrator, I see the file size when I edit the node containing the file. Why can this value not be used other than in edit mode?


To be complete I've added the query how it is now:

SELECT node.title AS node_title, node.nid AS nid, node.language AS node_language,   file_managed_file_usage.filesize AS file_managed_file_usage_filesize, 'node' AS  field_data_field_file_node_entity_type
FROM 
{node} node  
LEFT JOIN {file_usage} file_usage ON node.nid = file_usage.id AND file_usage.type = 'node'
LEFT JOIN {file_managed} file_managed_file_usage ON file_usage.fid = file_managed_file_usage.fid
WHERE (((node.status = '1') AND (node.type IN  ('file'))))
ORDER BY node_title ASC  
LIMIT 50 OFFSET 0
  • Did you ever get the issue resolved for file sizes on multiple files? I too have that same issue. – user20285 Aug 21 '13 at 16:32
  • Hi Adrew. No the issue is still there, but I have to admit that after my additional question about that was deleted here, I didn't put much effort in investigation this further. I had to post another questions at drupal.stackexchange.com/questions/45292/… and received one reply from someone that got this working. – Herbiek Aug 21 '13 at 21:14
15

Try creating a reference to the file.

Under Advanced in your View, and add a relationship (select File Usage: File). If you now go to add a new field in your view, you should see a few more options under File, one of them being File: Size.

  • Thank you for your great explanation which get me to put a third column containing file sizes. However, some of my content types contain 2 files. In the view only the filesize of the first file is shown, not the other ones. Any idea how to fix that? – Herbiek Sep 13 '12 at 21:20

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.