Single document, multiple filetypes for download: how to manage? I want to upload/attach several documents to a book node. Each document will be offered in a number of file formats, for example:


Report2010.pdf
Report2010.rtf
Report2010.doc
Agreement11.pdf
Agreement11.rtf
Agreement11.doc


Given this, in order to:


Offer a sensible upload interface (like FileField) that allows an unlimited number of files to be uploaded.
Present these files for download, for example:

Report 2010 - Download as: pdf, rtf, doc
Agreement 11 - Download as: pdf, rtf, doc



Is there a robust way to relate the different file formats for each document to each other? By robust, I mean something that (for example) doesn't rely on the user naming the files in a particular way for it to work.
node-[type].tpl.php

$fields = array('field_reports', 'field_agreements'); // you should to create 2 fields for different filenames
$items = array();
foreach($fields AS $field){
  $exts = array();
  foreach($node-&gt;{$field} AS $file){
    // delete real extension from file name
    $filename = explode('.', $file['filename']);
    $ext = array_pop($filename);
    $exts[$ext] = l($ext, $file['filepath']);
    $filename = implode('.', $filename);
  }
  ksort($exts);
  $items[] = t('!filename - download as: !links', array('!filename' =&gt; $filename, '!links' =&gt; implode(', ', $exts)));
}
print theme_item_list($items);


Hovewer, this code must be in template.php in phptemplate_preprocess_node function.