--- \Downloads\project_release.module.1.25	2007-07-02 23:13:58.000000000 -0400
+++ \Downloads\project_release.module.new	2007-07-02 23:13:48.000000000 -0400
@@ -1767,4 +1767,36 @@
   else {
     return l($link_text, $link_path);
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Builds the HTTP headers for transferring a given file known to the module.
+ *
+ * @param $filename
+ *   The name of the file to download.
+  * @return
+ *   An array of header fields for the download.
+ */
+ function project_release_file_download($filename) {
+  $path = file_create_path($filename);
+  $result = db_query("SELECT f.* FROM {project_release_nodes} f WHERE file_path = '%s'", $path);
+  if ($file = db_fetch_object($result)) {
+    if (user_access('view uploaded files')) {
+      $node = node_load($file->nid);
+      if (node_access('view', $node)) {
+        return array(
+          'Content-Type: application/force-download',
+          'Content-Length: '. filesize($path),
+          'Content-disposition: attachment; filename="' . $filename . '"',
+          'Content-Transfer-Encoding: binary'
+        );
+      }
+      else {
+        return -1;
+      }
+    }
+    else {
+      return -1;
+    }
+  }
+}
