The best module to allow file uploads to have metadata?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
estephan500's picture

Hello all. My apologies if this question belongs in a more entry-level group (let me know if you recommend one.)

The question: The site I'm building will need to have a strong ability to present files for download by users. The out-of-the-box drupal has the Uploads module, which allows us to place files onto the site. However, there is no functionality for the uploader to include metadata for the file like name, author, date, keywords, etc.

-- What is the most established/respected/good module that will allow uploads to have metadata?

-- ALSO, I really want for the uploaded files to not be "ghettoized" and only be accessible only within a designated "files area" -- instead, I'd really like to be able to have these nicely-metadata'd-files to appear on various content pages/stories/etc...

Thanks for any modules or methods you can recommend!

Eric

Comments

Filefield

laken's picture

Take a look at the Filefield module, which is a content-type plug-in for CCK:

http://drupalmodules.com/module/filefield

This lets you add a file upload field to any content type. You can create as many metadata fields as you want in the content type as well. This is a well-regarded and maintained module. Just read the module page and installation instructions carefully, and there are different versions for Drupal 5 and 6, and I think it requires PHP 5.2 as well.

One thing I like about it

There are also many companion modules that work with filefield to meet specific needs.

Good luck!

Hi, thanks for your helpful

Flying Drupalist's picture

Hi, thanks for your helpful post. I love the filefield module, but I cannot understand how to display the metadata. How do you create a metadata field? I would like for instance, for the author to enter into the author vocabulary. How would I do that? Thanks.

Depends on what you're trying to do

laken's picture

There's many ways to approach this depending on your needs. In my case, I create a new content type called, say, Document, and I create several fields in that content type, like Description, Category (could be a CCK text/select field or a taxonomy vocabulary,) Author, or whatever. So the filefield is just one field in a complete content type, and the other fields can hold the metadata.

I'm unclear what you're asking when you say "I would like for instance, for the author to enter into the author vocabulary." If you mean you have a taxonomy vocabulary of Authors, just apply that vocab to the content type you made.

If you could be more specific, I could help more specifically.

Hi, when we're talking about

Flying Drupalist's picture

Hi, when we're talking about metadata we're talking about id3 info or exif info right? The job of filefield should be to take such information from the file and then automatically insert it into the appropriate fields. I was under the impression that Filefield should be able to do this with the Filefield meta module (which comes with I think), but I haven't been able to figure out how.

This is what metadata support entails really, without this you can't really say Filefield has metadata support.

Ah now I see

laken's picture

Now I see what you're after - real, cold hard metadata for established formats. Backing up a sec, some history is in order. Before CCK came along folks were doing great things using Drupal with images, sound, and video, but these came in the form of monolithic modules that handled these functions, like image.module, audio.module, etc. Not sure about Image module and EXIF, but I do have experience with Audio module's metadata handling: it uses an external ID3 library and is very good at extracting tags from MP3 files and storing/displaying the metadata, making playlists, podcasts, etc. It's awesome.

But now the trend is to CCK everywhere and there have been efforts to put this type of specialized metadata handling into CCK field-type modules. I know filefield has some support for this, and some is experimental, but it's beyond what I've actually tried. Here's a helper module for audio to get you started:

http://drupal.org/project/audio_filefield

At the moment, filefield may not be a do-everything solution (though there are some who would like to move it in that direction.) There are also CCK modules other than filefield which handle metadata, I believe, so you check them out before settling on a final solution. Try http://drupal.org/project/Modules/category/88 and http://drupal.org/project/Modules/category/88 to browse for ideas. http://jakob.petsovits.at/one-file-field-to-rule-them-all also provides some interesting insights.

Hope this is helpful!

Yes, thank you very much,

Flying Drupalist's picture

Yes, thank you very much, that was helpful.

What confused me was the existence of the filefield meta module, which like audio, requires the Getid3 module, and I distinctly remember hearing that the meta module should be able to extract the metadata from filefield. I haven't been able to figure out how to configure the module to do this however. But this could just be a mistake on my part, and the filefield meta module could simply not work yet. But I'm ever hopeful. :)

Using filefield for my goals...

estephan500's picture

Thanks again for the Filefield tip. I've installed it and it's functioning, and I've made a content type that has filefield working on it, but as I have it now, it is mainly behaving much like the Upload functionality that comes with drupal out of the box --

I was wondering -- let's say I would like it so that one regular "Page" node on my site is called "2008 Guidance Documents" -- and that page had some nice introductory text etc. on it. And then at the bottom of that page, assume that I wanted there to be five PDF documents uploaded onto that page, but each one of those documents would have its own metadata entered for it... for instance, a Document Title (since the filename isn't a strong title for the document), The date of publication, Author, institution, and the downloadable file itself.

Any way to handle that challenge? I could see that I could create a Document content type as you describe above that would have those great metadata fields, but then the challenge of having five of those "Document" types listed nicely at the bottom of an existing drupal Page is the challenge that I face. Keep in mind that I'm new to drupal so this might be a more rudimentary question than you were thinking I was asking. (in a way, it's kind of like the way that a given Project page on drupal.org manages to have those nice multiple entries for the downloadable modules, like the green and red entries on http://drupal.org/project/filefield)

thanks!!
eric

two issues...

estephan500's picture

Miraploy and I are of course talking about two separate things -- I guess he's interested in Filefield being able to detect and actually relate 1d3 stuff in the file as put on the page -- whereas my goal is much simpler -- how to get multiple entries of a given nicely-made "file" content type to appear on a single page.

thx

Here's one way to do it

laken's picture

Okay, now we get down to some real use cases - awesome!

The way I would handle this (and I'm sure there are other ways) is by adding a cck nodereference field in the Page content type that refers to the Document content type.

If you're not familiar with it, Nodereference fields are a way to make a relationship between one content type and another, much like you have relations between tables in a relational database.

To do this, first make sure you've installed and enabled CCK and the nodereference submodule. Then edit your Page content type and add a field. On the add field form, you'll see this:

Only local images are allowed.

This will be the field that attached related document nodes to the Page. Give the new field a name like "related_documents". "Select List" and "Autocomplete text field" are your options for the widget that will be used when picking the related document nodes. Select is a drop-down or a select box, so If you have a small # of documents this can be good. If you have 100's or 1000's of docs, you probably want the Autocomplete widget, which lets you type some of the node name and will give you an ajax list of matching nodes for you to select. Try out both and see which you like...

On the next page you'll see this:

Only local images are allowed.

Since you want to be able to attach more than one document to your page, check "multiple values". If you want to enforce that every page must have at least one document attached to it, also check "required". Then in "Content types that can be referenced" select your Document content type. Save and you're done - you should now be able to add and edit Page nodes and reference 1 or more Document nodes in each Page.

Theming this nodereference stuff can get a little challenging. Some folks use the Contemplate module to pick and choose which content fields go into your final node, and it also lets you edit the markup. I use Contemplate, but it can sometimes not work great with some 3rd party modules.

Other option is to dive headfirst into the world of CCK theming - I think there's a handbook section called CCK for themers that should have relevant info.

One thing I forgot to mention is that Filefield itself lets you check a "multiple" checbox, meaning that within a single Document node (and a single file field) it can handle multiple files. I like to use this for a document "bundle" when I have a set of related files (perhaps all from one event, author, or whatever) where the other fields would be the same (date, author, category, etc.) So don't overlook this!

Hope this helps!

Node reference worked great

estephan500's picture

Awesome -- that worked like a charm! This guy knows what he's talking about. Thanks so much!

I notice that, as you mentioned, the way that the multiple Document objects appear on the Page -- is not super beautiful, and it would be nice if more of that item's fields actually appeared on the item's "listing" on the page. (and perhaps a download link itself, without having to zap through to the document record itself.) BUT I believe that is the Theming issue you mentioned in your post. I'll keep learning. If you recommend a source for learning about theming, let me know.

Thanks again!!

eric

dellintosh's picture

For controlling lists of content, it would be a VERY GOOD IDEA to learn how Views module works. It will do what you are requesting (output a list of the document objects, and a download link for the file if you prefer). So that'd be good anyway to learn. :)

As for the theming side of things, there are a great number of resources for learning about it. A couple which I keep in my belt to toss the way of the new learners are:

Drupal 6 Themes book (or Drupal 5 if you're still working with that)
Theme Guide right here on Drupal.org! :D Absolutely free!

There are also a number of videos on the web about theming in Drupal which address a number of specific tasks. If you like videos, check out (of course) the Drupal Dojo screencasts... although some are a bit old, they still will give you GREAT guidance on how the theming works in Drupal.

Another screencast which I subscribe to (good tips, and he also adds videos from Lullabot and others to his feed so you can catch those too), is MustardSeed Media.

Hope those help you get started. Also if you get stuck the folks in the irc #drupal-themes are a great help too!

-dellintosh

great

estephan500's picture

excellent, thanks -- and I've been meaning to learn the views module! great. thx--eric

Happy that worked for you

laken's picture

Really glad you found that helpful!

I'm pretty slammed on a project right now, so time for posting here is limited. When I free up some, I can respond with more specific tips on theming etc.

great info, thanks again

estephan500's picture

Thanks again folks -- I'm well on my way now.

thx
eric

thanks much

estephan500's picture

Thanks for the recommendation, alaken -- I'll give it a try and see if any other questions arise. Appreciate it!

Also, if anyone wants to throw more ideas or recommendations into the mix then please do!

eric

Thanks!!

estephan500's picture

Wow, really appreciate your guidance. I'll go through your instructions and give it a try, but wanted to say thanks first. thanks much!

eric

Alternative

gblogger's picture

Or, you could use the File Framework module. This is for D6 only and is still new but looks very promising. Might want to keep an eye out for that one.

I have tested the filefield

zaczek's picture

I have tested the filefield meta module with CCK, Views2 and Media Mover and have discovered that it DOES insert ID3 metadata automatically in the "filefield_meta" table and makes it available in Views2.

(You need to create a relationship with the filefield in your view, and the metadata fields will be available in the File: category in your view).

HOWEVER, the metadata is only for audio. Apparently, other fields were not taken into account. GetID3 is able to see much more: video codecs, framerates, etc...

I am currently working on making a patch for filefield_meta to save automatically video metadata. I will post the patch when ready here:
http://drupal.org/node/555174