title: file_put_contents() or similar to create new photo
body: <p>I receive a string of base64 and am able to decode it and put it into a file. The problem is, I would like to create a new image file each time to put this base64 into.</p>
  
  <p>Currently I have a basic code which is able to put contents into the file that is pre-existing but the current code does not create a non-existent file.</p>
  
  <pre><code>$data = base64_decode($data);
  
  $path = 'abc';
  
  var_dump(is_dir($path));
  
  if ( ! is_dir($path)) {
      if(mkdir($path, 0777)) {
        echo "created dir";
      }
  }
  
  file_put_contents('tmp.png', $data);
  </code></pre>