When I open the file (dirname(FILE).‘/…/…/…/public/files/’.$event[‘file’]), I get an error => Failed to open stream: No such file or directory.
If I check with file_exists everything is fine.
I checked that the user who accesses the file is indeed the owner of the file.
The “Failed to open stream: No such file or directory” error typically occurs when PHP cannot find the file you are trying to open at the specified path, but maybe there are other issues preventing you from opening it.
You can use __DIR__ to get the current directory of the script and then build the absolute path from there. Check the Path: Make sure that the path you are using to open the file is correct.
Ensure that the file has the correct permissions that allow the user running the PHP script to read it. You can use chmod to modify file permissions.
Also double-check that the user executing the PHP script is the owner of the file and has the necessary permissions.
When I ls -l /web/src/Console/Events/../../../public/files/, I get : -rw-r--r-- 1 sys_eventsDEV_23 client2 1839114 Nov 21 17:04 IMG_9228.jpg
=> I
And, when I try to open the file, I get this : Warning: fopen(/web/src/Console/Events/../../../public/files/IMG/9228.jpg): Failed to open stream: No such file or directory