hecate hecate - 9 months ago 59
PHP Question

php - fopen(src_new/temp@2016-10-27_06:45:54.php): failed to open stream: Invalid argument

$file="src_new/".$filename."@".date("Y-m-d_H:i:s",strtotime("now + 3 hours + 45 minutes")).".php";
$writeHandle=fopen($file,"w"); // Error is thrown here

I don't understand why it fails to open a file of filename name "temp" appended with the current date and time. Can anyone here please enlighten me on this ?

Note: I have tried escaped backslashes i.e '\' too in the file path but the result no different from the current one.

Answer Source

MS Windows doesn't "love" colons.

Recommend rename files to: Y-m-d_H.i.s

It works fine for all platforms and filesystems.