Question

Say I have a file in my kohana 3 website called assets/somefile.jpg. I can get the url to that file by doing

 echo Url::site('assets/somefile.jpg'); // /kohana/assets/somefile.jpg

Is there a way I can get the absolute path to that file? Like if I want to fopen it or get the size of the file or something like that.

In other words, I would like to get something like /var/www/kohana/assets/somefile.jpg or W:\www\kohana\assets\somefile.jpg or whatever is the absolute path.

Was it helpful?

Solution

I think you want:

DOCROOT.'assets/somefile.jpg'

OTHER TIPS

I haven't worked with Kohana but isn't that the job of Kohana::find_file?

Finds the path of a file by directory, filename, and extension. If no extension is given, the default EXT extension will be used.

When searching the "config" or "i18n" directory, an array of files will be returned. These files will return arrays which must be merged together.

Try echo realpath('assets/somefile.jpg').

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top