The reason it's not working is that you're giving fopen a relative path. This works fine with your test file if it's placed in the webroot, since the path is relative to that. But inside a template file, the relative path does not resolve correctly.
For a static file, you can use $config->paths to retrieve an absolute base path that will always work:
$f = fopen($config->paths->files . "1619/dundee.csv", "r");
If you want to read a CSV file uploaded to a page field, you can use Pagefile::filename instead:
$filename = $page->your_csv_field->filename();
$f = fopen($filename, "r");
Make sure your CSV field is set to single file output. If your field allows multiple files, use $page->your_csv_field->first()->filename() instead.