[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?

wants us to help you build drupal website ?

contact us  and let's fix your Drupal website

 

CMS -Content Management Systems
What is a CMS website
Drupal CMS
The Benefits of a Drupal website
DevArt- drupal websites
DevArt the website you need

Latest Tweets

checking if we should replace our java-app with Scala + Lift 2 days 14 hours ago
I'm hiring a senior Java programmer 4 days 11 hours ago
got our new website on air - http://t.co/NsV6xFLI tell me if you like it or not 5 weeks 2 days ago
בואו לראות את האתר חדש שהעלינו היום- http://lnkd.in/dm6TVj 1 year 1 day ago
פורמייקה פסים אפור kitchen-stock.co.il/content/פורמייקה-פסים-אפור 1 year 7 weeks 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.