4

I have a Node Type A that is referred to by a bunch of other nodes. Within the nodes that are referring to Node Type A, there are various and separate CCK file fields. I have configured all of these files to be saved in a directory that is named with the title of each Node Type A (with the FileField Paths module)...so all of the corresponding files for a Type A node are in one place. I need to create a view that displays all of the files from the referring nodes in a sortable table. The problem that I'm running into, is that I have to add each separate CCK file field from an assortment of different node types to the view, which generates empty fields in the rows ouput.

So can I build a view that pulls the files from a specific directory on the server?

5 Answers 5

0

As Jim Kirkpatrick said, you want to create a new View selecting "Files".

Then in the Filters you enter the path you want to view (you could also use attributes, if you have very many node types, it would be faster but requires you to enter the node type in the view path... although you can later hide that using URL aliases.)

Note that only works for files that appear in the Drupal Core file upload table. Any other file is not known by the system and thus won't just show up in the view.

4
  • That works! I'll mark your answer as correct unless Jim moves his comment into the answers.
    – user2014
    Jan 6, 2012 at 3:22
  • a long shot since this is such an old thread, but am failing to see a key piece of the puzzle. D7. I have a 'files' based View. In the list of files I note that some subfolders of root (eg public://feeds) have their files listed, but others such as public://images do not. any thoughts? May 2, 2021 at 21:38
  • @petednz-fuzion I'm not using Drupal anymore, so I have no clue where it's at. In the old days, we did not have the protocol (public: and private:). Actually, it was problematic. You could have a site with files that are either all public or all private... May 12, 2021 at 15:33
  • thanks for responding. May 12, 2021 at 19:51
2

Only tools I've seen dealing with showing file are more like this...

http://drupal.org/project/elfinder

http://drupal.org/project/webfm

http://drupal.org/project/manager

http://drupal.org/project/filebrowser

You can create a view of all attachments to nodes, but that's not what you want either.

1

In Drupal 7 you can create a view of files, with path as one of the available filters.

In Drupal 6 the Table Wizard and the Data allow you to pull database tables in to views, so it's an extra step but perhaps you could create a table to maintain a list of files and their paths then use one of these modules to create a view.

2
  • 1
    You can create a view of files and add a filter where path contains a string in Drupal 6 views too. Dec 22, 2011 at 17:34
  • That works. Post your comment as an answer if you want the points.
    – user2014
    Jan 6, 2012 at 3:21
0

Look at the Style Settings/Theme Information on your view and dive into the Row style output template for your view. You most probably can throw some php code in there to skip the empty fields...

0

From another drupal.stackexchange answer, this module called Filebrowser looks like an ideal solution (I've yet to test) for discrete folder listing of files. From the Filebrowser project page:

You will create one node (node type dir_listing) for each each Directory Listing (DL). Node settings are used to control access and other features of the DL. These settings can vary per node and per user.

This module offers the following features:

Private downloads so that files (such as PHP files) can be downloaded. File blacklists so that specific files can be removed from directory listings. Node-based. All features available to nodes, such as path aliasing and access control can be applied to directory listings. Settings to limit exploration of subdirectories

The latest Filebrowser version 7.x-4.0-rc1 can do multiple file uploads (drag and drop) if the Plupload module along with the Plupload library dependency (ie extract zip file into library folder at sites/all/libraries/plupload) are available. Looks like it offers file meta-information options as well.

screenshot from project page

The .info file for Filebrowser does not have a Views dependency so it is likely Views contextual filters or Views relationships needs tweaking, or alternately some type of views enhancement module such as the popular EVA - Entity Views Attachment, or block or entity reference module possibly with Context module, could be needed to solve the display/view/layout in cases like this question. Also, depending on the roles/permissions that Filebrowser does, or may not have, coded into this module with its content type, ACL (Access Control Lists) with Content Access might be additional modules for privacy of the custom file listings/nodes.

Kudos to the community developers for this module, that is showing active development activity at the time of this answer. Try to contribute back folks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.