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?

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.

| improve this answer | |
  • That works! I'll mark your answer as correct unless Jim moves his comment into the answers. – user2014 Jan 6 '12 at 3:22
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.

| improve this answer | |
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...

| improve this answer | |
0

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.

| improve this answer | |
  • 1
    You can create a view of files and add a filter where path contains a string in Drupal 6 views too. – Jim Kirkpatrick Dec 22 '11 at 17:34
  • That works. Post your comment as an answer if you want the points. – user2014 Jan 6 '12 at 3:21
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!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy