Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

file path from sql query in drupal

I'm writing to get the filepath ie "/sites/default/files/myfile.pdf" for my file uploads.

I'm using the below

$row['node_data_field_factsheet_field_factsheet_data']

this returns "a:1:{s:11:"description";s:0:"";}"

How do i get the actual path?

here is my sql statement.
SELECT node.nid AS nid,
   node_data_field_factsheet.field_factsheet_fid AS node_data_field_factsheet_field_factsheet_fid,
   node_data_field_factsheet.field_factsheet_list AS node_data_field_factsheet_field_factsheet_list,
   node_data_field_factsheet.field_factsheet_data AS node_data_field_factsheet_field_factsheet_data,
   node.type AS node_type,
   node.vid AS node_vid
 FROM node node 
 LEFT JOIN content_type_fund node_data_field_factsheet ON node.vid = node_data_field_factsheet.vid
 WHERE node.type in ('fund')

Open in new window

0
frosty1
Asked:
frosty1
1 Solution
 
oliverpoldenCommented:
This should point you in the right direction.  You can use print_r() to check the returned array, or dpr() with the devel module.

$fid = $row['node_data_field_factsheet_field_factsheet_fid'];

http://drupalcontrib.org/api/function/field_file_load/6/references
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now