title: Codeigniter | Save Base64 image to file
body: <p>I have created a custom product configurator that saves a canvas element as a base64 encoded image. When I echo the image in the browser as the image src it works fine.</p>
  
  <p>So something like this works:</p>
  
  <pre><code>$base64Image = $_POST['dataUrl'];
  echo '&lt;img src="'.$base64Image.'" /&gt;';
  </code></pre>
  
  <p>My problem is that codeigniter wont add this base64 image src to the session, probably because its too big. I have tried some methods that people have used to write an image to the server and they all throw errors. Does anyone know how I can write this base64 string to an image on the server like 'myimage.png' in the images/custom folder?</p>
  
  <p>Any help is appreciated.</p>