title: Download files file_put_contents with progress
body: <p>I try to write code with download file and return status (downloaded bytes).
  To download file I use file_put_contents and it's work.</p>
  
  <pre><code>function downloadLink($link,$destination)
  {
      $ctx = stream_context_create();
      stream_context_set_params($ctx, array("notification" =&gt; "stream_notification_callback"));
      $mb_download = file_put_contents($destination, fopen($link, 'r'),null,$ctx);
      return $mb_download;
  }
  
  function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
      file_put_contents( 'progress.txt', '' );
      $fp = fopen('progress.txt', 'a' );
      fputs( $fp,$bytes_transferred);
      fclose( $fp );
      echo 1;
  }
  </code></pre>
  
  <p>It's my functions. I have problem to use callback function because all function is inside the same class. Now stream_notification_callback is not use. I try change declaration to</p>
  
  <pre><code>stream_context_set_params($ctx, array("notification" =&gt; "$this-&gt;stream_notification_callback()"));
  </code></pre>
  
  <p>Or </p>
  
  <pre><code>stream_context_set_params($ctx, array("notification" =&gt; $this-&gt;stream_notification_callback()));
  </code></pre>
  
  <p>But it's not working.</p>