I am a .net guy and have got a code which works on one of our servers but not on the other, not even on my local machine. The code snippet is given below:
//$flocal1 = fopen($MVfile_name.".txt", "w");
//@fwrite($flocal1, "my name is gaurav pandey!!!");
//opening file
$flocal = fopen($MVfile_name, $mode);
//writing to file
if (!(@fwrite($flocal, $contents)))
{
//writing error if writing operation failed
exit(NotUpload);
}
//closing file fclose($flocal);
As we can see, I tried same code with writing a text file with a string and that worked fine, but with binary files, I am getting the error.