I'm trying to read a txt file with a controller that i've set up. However, I'm unsure where to place this file and how to call it correctly. Everything i've tried has resulted in the following error:
2015-01-21T13:57:02+00:00 ERR (3): Warning: file_get_contents(youtube_videos_only_hash.txt): failed to open stream: No such file or directory in /opt/magento/app/code/local/namespace/module/controllers/IndexController.php on line 9
Any help would be appreciated.
The error in question is related to the filepath:
$filepath = 'images/youtube_videos_only_hash.txt';
$hashes2 = file_get_contents($filepath);
file_exists($filepath)before attempting to read it. Tell us what's the output. – Julien Lachal Jan 21 '15 at 14:10var_dump(file_exists($filepath));die;that should suffice as far as seeing results is concerned. – Julien Lachal Jan 21 '15 at 14:21file_get_contents('./'.$filepath)? – Julien Lachal Jan 21 '15 at 14:24