Here’s a function that returns an array of filepaths for all files attached to a node.
function lookupFileAttachments($nid) {
$fileattachments = array();
$sql = 'SELECT u.description, f.filename, f.filepath ';
$sql .= 'FROM upload u, files f ';
$sql .= 'WHERE u.fid = f.fid ';
$sql .= 'AND u.nid = ' . $nid . ' ';
$res = db_query($sql);
while ($row = db_fetch_array($res)) {
$fileattachments[$row['filename']] = $row;
}
return $fileattachments;
} // end lookupFileAttachments