brumbrum brumbrum - 2 months ago 16
PHP Question

PHP - fopen(): failed to open stream: No such file or directory

In my code I create a file called

$cookie
. I than later want to open it and read contents from it, but I get the error
fopen(): failed to open stream: No such file or directory.
I have a feeling I messed up something related to paths. Any advice on how to tackle this?

I tried this:

<?php
$cookie = 'cookies3.txt';
..
$myfile = fopen("cookies3.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("cookies3.txt"));
fclose($myfile);

Answer

Yep, the file wasn't created. All thanks to fred -ii-.

Comments