How to get absolute path to asset file? I have some csv files uploaded as assets and now I need to fopen() them from my plugin.

I have an AssetFileModel but I have not been able to work out how to construct a full path to the file.

I can access the filename like: $asset->filename which gives me my_csv_file.csv but this is not enough for fopen() to find it.

How can I get the absolute path to the asset file? 

Or at least a path that I can use with fopen() to find the file?
You can get the rest of the path from your asset's source and folder, I think something like this should do it:

$source = $asset-&gt;getSource();

if ($source-&gt;type != 'Local')
{
    throw new Exception(Craft::t('Paths not available for non-local asset sources'));
}

$sourcePath = $source-&gt;settings['path'];
$folderPath = $asset-&gt;getFolder()-&gt;path;

$assetFilePath = $sourcePath.$folderPath.$asset-&gt;filename;