fwrite in php not working in binary mode -
i .net guy , have got code works on 1 of our servers not on other, not on local machine. code snippet given below:
//$flocal1 = fopen($mvfile_name.".txt", "w"); //@fwrite($flocal1, "my name gaurav pandey!!!"); //opening file $flocal = fopen($mvfile_name, $mode);
//writing file
if (!(@fwrite($flocal, $contents))) {
//writing error if writing operation failed
exit(notupload); }
//closing file fclose($flocal);
as can see, tried same code writing text file string , worked fine, binary files, getting error.
if you're on windows server, use b flag fopen.
fopen($filename, 'wb');
this should set php according manual, maybe on old server isn't case.
Comments
Post a Comment