fwrite in php not working in binary mode
<p>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:</p>

<pre><code>//$flocal1 = fopen($MVfile_name.".txt", "w");
//@fwrite($flocal1, "my name is gaurav pandey!!!");
//opening file
$flocal = fopen($MVfile_name, $mode);
</code></pre>

<p>//writing to file</p>

<pre><code>if (!(@fwrite($flocal, $contents))) 
{
</code></pre>

<p>//writing error if writing operation failed</p>

<pre><code>  exit(NotUpload);

}
</code></pre>

<p>//closing file 
     fclose($flocal);</p>

<p>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.</p>
