title: Wordpress media_sideload_image - Download http://placekitten.com/100/100?
body: <p><strong>media_sideload_image</strong></p>
  
  <p>WordPress have a function called <a href="http://codex.wordpress.org/Function_Reference/media_sideload_image" rel="nofollow">media_sideload_image</a>. It is used to upload an image and attach it to the media library.</p>
  
  <p><em><strong>I accepts image urls like this:</em></strong></p>
  
  <p>h**p://s.wordpress.org/style/images/wp-header-logo.png</p>
  
  <p><strong>Rewritten URLs</strong></p>
  
  <p>Some URLs on the web are rewritten, for example:</p>
  
  <p><a href="http://placekitten.com/100/100" rel="nofollow">http://placekitten.com/100/100</a></p>
  
  <p><strong>Error message:</strong></p>
  
  <p>"<em>Sorry, this file type is not permitted for security reasons.</em>"</p>
  
  <p>The file type is a correct JPG-file but the file extension is missing.</p>
  
  <p><strong>Adding extra MIME types don't work, in my case</strong></p>
  
  <p>I tried this function but it does not help me, because it's the file extension that is not set.</p>
  
  <pre><code>add_filter('upload_mimes', 'add_custom_upload_mimes');
  function add_custom_upload_mimes($existing_mimes){
      $existing_mimes['jpeg'] = 'image/jpeg';
      return $existing_mimes;
  }
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>How do I upload the URL h**p://placekitten.com/100/100 with media_sideload_image or alike to attach the image to the media library?</p>