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


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?

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

Yep. There is a function for that.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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