--- C:\Documents and Settings\Mike Carper\Desktop\filefield\filefield.module	Sun Mar 29 15:30:17 2009
+++ C:\Documents and Settings\Mike Carper\Desktop\filefield1\filefield.module	Mon Mar 30 23:03:04 2009
@@ -745,3 +745,43 @@
   $file->field = $field;
   return array();
 }
+
+/**
+ * Get all FileField files connected to a node ID.
+ *
+ * @param $nid
+ *   The node object.
+ * @param $field_name
+ *   Optional. The CCK field name.
+ * @return
+ *   An array of all files attached to that field (or all fields).
+ */
+function filefield_get_node_files($node, $field_name = NULL) {
+  $files = array();
+
+  // Get a list of fields. If $field_name is NULL, all fields are returned.
+  $fields = content_fields($field_name, $node->type);
+  if (isset($field_name)) {
+    $fields = array($fields);
+  }
+
+  // Get the file rows.
+  foreach ($fields as $field) {
+    if ($field['type'] != 'filefield') {
+      continue;
+    }
+    $db_info = content_database_info($field);
+    $sql =  "SELECT f.* ";
+    $sql .= "FROM {files} f ";
+    $sql .= "INNER JOIN {" . $db_info['table'] . "} c ";
+    $sql .= "ON f.fid = c." . $db_info['columns']['fid']['column'] . " ";
+    $sql .= "AND c.vid = %d";
+
+    $result = db_query($sql, $node->vid);
+    while ($file = db_fetch_array($result)) {
+      $files[$file['fid']] = $file;
+    }
+  }
+
+  return $files;
+}
\ No newline at end of file
