URL to file

Permalink
I'm trying to get the full path to a selected file. So far I learned how to get the relative path by digging through other blocks, but haven't learned how to get the full path. ie: I needhttp://www.a.com/index.php/...)

View::url('/download_file', $fID);


There's something I'm missing. I'm still learning the OO side of PHP in my spare time, but I haven't progressed very far! Thanks for any help!

jizzle
 
okhayat replied on at Permalink Reply
okhayat
use the getPath() method of the File class
<?php
$file = File::getByID($fID);
$path = $file->getPath()
?>

The $path variable should now have the full path to the file.
Check out the documentation at:
http://docs.concrete5addons.com/...
jizzle replied on at Permalink Reply
jizzle
Sorry, I should have said full URL to the file. But your post directed my to getUrl and is working. Thanks!
elyon replied on at Permalink Reply
elyon
You can also use getRelativePath or getDownloadURL, depending upon what you need.