How to get a file attached to node with nid
Published by drupal on February 18th, 2009 in Drupal Modules
How would I retrive the filepath of the attached file that is attached to a node with nid 5.
It seems simple, but I just can't find the answer.
drupal_developer on February 19th 2009
all files details are stored in files table. You can just write a query that will return filepath.
ex:
$nid = node_id(id of the node like 5);
$result = db_result(db_query("SELECT filepath FROM files WHERE nid = %d, $nid));