Dimitrios Stefos Dimitrios Stefos - 2 years ago 185
JSON Question

Laravel fopen() cant create/read file

so I have this Laravel project and I want to export an array to a json file to use it later. My permissions on the storage folder are 777 but when I do


I also tried


and in both cases (plus some more) I get this error

file_put_contents(storage/app/test.json): failed to open stream: No such file or directory

Do you have any idea why is this happening?

Answer Source

You are working with storage folder but by default the path takes from public that why you need to use ../
Try like this

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download