0

I need to get the relative path to a file, in this case, what i need is:

/sites/default/files/pics/DSC00873_39.JPG

But all I seem to be able to get is the following:

$file = file_load($pic);
print $file->uri; // public://pics/DSC00873_39.JPG 

Any ideas please?

1
  • I don't get it. What does the UID have to do with anything?
    – Chance G
    Commented Feb 22, 2013 at 0:22

1 Answer 1

2

Yep. There is a function for that.

http://api.drupal.org/api/drupal/includes%21file.inc/function/file_create_url/7

1
  • 1
    yep, return file_create_url($file->uri);
    – rix
    Commented Feb 23, 2013 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.