Hi everyone!!

I'm trying to create a kind of repository where i can store pdf documents and then
allow users to download this pdf's.

Do you know a way to get it??? Is there a module that works like that???

Thank's in advance!!!!!!

Comments

dellintosh’s picture

What comes to mind for something like this would be

CCK (along with the file upload field type)
Views

Create a content type with CCK allowing file uploads, then use Views to display the list of PDFs available for download. Fast solution, plus it gets you used to using CCK and Views to do all sorts of amazing things with Drupal.

-dellintosh

wr5aw’s picture

That's exactly what I did last night and it worked perfectly. What I needed was a repository for club newsletters, grouped by year. Here's what I did:

  1. Added a content type - Newsletters
  • Added CCK field type file
    • Path - newsletters (gives files their own folder under default/files)
  • In Submission form settings, changed Title field label to Description
  • Deleted Body field label (prevents body field from showing)
  • Rearranged field layout to my liking.
  • Created a Taxonomy vocabulary named Newsletter Year
    • Content Type - Newsletters
    • Settings - Required
    • Created a term for each year - 2006, 2007, etc.
  • Created a View (clone Taxonomy)
    • Page Settings:
      • Path - newsletters/%
    • Basic Settings:
      • Style: Table
        • Grouping Field: Taxonomy: Term
      • Use Pager: Yes
      • Header: Full Html
        • Here, I put an h2 Title linked to newsletters/all, a short descriptive paragraph, a horizontal rule, and links - one for each year (taxonomy term).
      • Footer: Full Html
        • I had a short footnote then a standard requires Adobe reader paragraph with a link to the Adobe download
    • Arguments: Taxonomy Term
    • Fields:
      • Content: Filename - (field_filename) Generic files
      • Node: Title
      • Node: Edit Link
      • Taxonomy: Term (Exlude from display)
    • Sort Criteria:
      • Node: Sticky desc
      • Taxonomy: Term desc
      • Node: Post Date desc
    • Filters:
      • Node: Published or admin
      • Taxonomy: Vocabulary = Newsletter Year

    All in all, it turned out to be a pretty nice display, has paging, grouped by year, and can display files for a single year.

    jesusDrupal’s picture

    Hi wr5aw,

    this is a real help. I have a question, i'm developing my own modules to get
    my objectives. I think implementing this with CCK is not a problem to my applicaction, isn't it?
    I mean, is there any problem if you develop a part of the applciation with CCK and another
    with code?

    Thanks a lot!!

    wr5aw’s picture

    I'm about to create a training database to keep track of club members, contact info, assets, classes completed, certifications, etc. Initially, I setup a members CCK type and created the required fields and the view. But, after thinking about it, decided to do a stand-alone relational db app instead. I'm just not too crazy about having everything tied to the node table. Plus, it'll make the data much more portable.

    Back to my original post, I finally went live with the site I was working on. Here's the newsletter repository I built from CCK filetype and views - http://w5pc.org/newsletters/all.

    cog.rusty’s picture

    There are several solutions. First, there are a couple for simple file management needs. There is http://drupal.org/project/filebrowser, with file metadata stored in descript.ion files, and http://drupal.org/project/webfm, with file management based on the directory structure, using AJAX.

    The more thorough solutions involve attaching the files to Drupal posts of a special node type. This way, you can include metadata in the content, categorize them using taxonomy, and list them in tables by category or by combination of categories with the help of the views module. To attach files to to nodes you can use either the upload module (in core) or the filefield module (together with the cck module). In both cases, there are also modules which can store the files in a custom directory structure.

    jesusDrupal’s picture

    Hi cog.rusty!!!

    Thank's for your response. I've a doubt. It's about the upload module. I don't know
    how i can use it because i haven't found examples of its use. Do you know a web where
    i could find them?? And do you know the name of any module to store the file in a directory,
    as you said to me before??

    Sorry but i'm a little lost with it because i'm newbie with Drupal.

    Thanks a lot!!!

    cog.rusty’s picture

    The upload module is included in Drupal and you can enable it in the admin/build/modules page. It simply adds an option in the editing form to attach one or more files to a post. If you want to store its files in a custom directory structure, you also need:

    http://drupal.org/project/uploadpath (optional)
    http://drupal.org/project/token (optional)

    Alternatively, instead of the upload module, you can use:
    http://drupal.org/project/filefield
    http://drupal.org/project/cck
    http://drupal.org/project/contemplate (optional, for theming)
    http://drupal.org/project/filefield_paths (optional)
    http://drupal.org/project/token (optional)

    In both case, the idea is to create a special content type for files and then to attach one file per node, so that (a) the node can describe the file and (b) by tagging the node with some categories you are essentially tagging the file.

    Then, the http://drupal.org/project/views module can produce listings or tables of your nodes/files by category etc.

    The advantage of filefield is that it makes a node more structured, expecting a file link at a specific place in it, in a named field, which can make theming more precise. The advantage of the upload module is that it is lighter and simpler.