[Skip Header and Navigation] [Jump to Main Content]

function return filepath from file id

We had to use the filepath instead of fid more then once,

Here is a small function we wrote, returning the filepath from the fid

 


/**  * Get filepath by fid  */ 
function filepath($fid) {   
if (is_numeric($fid)) {     
  $filepath = db_fetch_object(db_query("SELECT filepath FROM files WHERE fid = '%s'", $fid));     
if (is_string($filepath->filepath))       
    return $filepath->filepath;     
  else return FALSE;   
} else return FALSE; 
}

<p>

  

Liked it? have a Question on it?

Write a comment

The Devart Team

Why CMS ?
Find why you need a CMS web site
Why Drupal ?
Find why you need a Drupal web site
Why Us ?
Find why DevArt is the company you need

Latest Tweets

DevArt: דרופל הגיע לממשלת ישראל ! http://tinyurl.com/3x5k4zw 5 days 14 hours ago
DevArt: יבוא נתונים וניהול מסדי נתונים בדרופל http://tinyurl.com/35khcav 1 week 4 days ago
DevArt: קביעת שפה הכניסה לאתר לפי ארץ באתר רב לשוני http://tinyurl.com/34ft4s9 2 weeks 5 days ago
DevArt: בניית אתרים דרופל- סיפורי לקוחות מרוצים http://dev-art.net/he/testimonials 3 weeks 3 days ago
Happy customers, tell about their drupal website built with DevArt http://dev-art.net/en/testimonials 3 weeks 4 days ago

Testimony

I have worked with DevArt for over a year and I highly recommend them for any drupal needs.

 

What has impressed me most about Avior, is his loyalty and integrity. He has always been there for my company and because I was a start up company even helped me out on a payment plan. He's also a very hard worker and worked many late nights before my launch

 

Andrew Gitt

Principal & CMO

Story Time For Me, Inc.