0

I have an endless loop for websockets and one of the task is to check if the file (whose name came through ws message) is already on the server (message is usualy faster the the fileupload). The filename is still the same, so I wanted to check the upload datetime, but whatever i do the file()time is in the loop still the same... I have tried:upload a new file, change datetime on a server even delete the file... no change... not even setting

Any ideas? Thanks


$file_path = "myimg.jpeg";
while (true)
{
  
  unset($file_path); // no effect either
  $file_path = "myimg.jpeg"; // no effect either

  echo "c:" . filectime($file_path) . " a:". fileatime($file_path) . " m:" . filemtime($file_path) . "\r\n";
}```
Láďa
  • 5
  • 4
  • I'm pretty sure that the status cache is the problem, see [`clearstatcache`](https://www.php.net/manual/en/function.clearstatcache.php) – Chris Haas Nov 14 '21 at 15:08
  • @ChrisHaas That's it. You are a legend. Thank you Chris – Láďa Nov 14 '21 at 15:17
  • There [was talk](https://externals.io/message/115912) of giving people that ability to turn this off in an ini setting, but it [looks like it didn't make it into 8.1](https://github.com/php/php-src/pull/5894). – Chris Haas Nov 14 '21 at 15:28

0 Answers0