title: error clause for file_put_contents
body: <p>I am using this line to obtain and save an image from a URL.</p>
  
  <pre><code>file_put_contents("./images/".$pk.".jpg", file_get_contents($PIC_URL))
  </code></pre>
  
  <p>I am unsure what the best way to deal with an error is. At the moment it is failing because there is no permission, which will be remedied shortly, but I would like it to be able to deal with situations where PIC_URL is empty or not an image. Should I dead with the error at this level(probably it is better for permission related things) or should I check higher up if PIC_URL is empty, or both?</p>
  
  <p>Which is the best approach?</p>