PHP: Copy() producing empty files
<p>I am using the following function to <code>copy()</code> a file, The files are typically 1-50KB in size and a file of the correct name is created but it is completely empty.</p>

<pre><code>public function backup() {
    $backup = $this-&gt;_root.'/cfg_'.date('d_m_y').'.backup';
    if (!copy($this-&gt;_file, $backup))
        return false;
    return $backup;
}
</code></pre>

<p>I know for certain that <code>$this-&gt;_file</code> correctly points to the file I am attempting to copy. <code>$this-&gt;_file</code> is created by another method of the same class and I perform a <code>chmod()</code> with an octal value of 0755 on it as shown in the following function:</p>

<pre><code>private function createFile($filename) {
    if (!($this-&gt;_pointer = @fopen($filename, 'cb')))
        return false;
    fclose($this-&gt;_pointer);
    chmod($filename, 0755);
    return true;
}
</code></pre>

<p>Does anyone know what could be causing this behaviour?</p>
