how I can change in cakephp the default directory where the files are created,for example with the function:
$fp = fopen('data.txt', 'w');
fwrite($fp, 'example');
fclose($fp);
In cakephp when I do this,files are created by default in webroot, I am interested in change this folder for all created files, I’m not interested in changing it every time I create a file.
So How I change this default directory?
You should specify the path from the webroot
/path/to/the/folder/And in order to do what you want you could define a constant when CakePHP initializes with the path to the specific folder, like this:
And when you use fopen, you can do this:
Hope that helps.