<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1041286" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1041286</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Another note,
If all checks</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/image-upload-code#comment-1230608</link>
    <description> &lt;p&gt;Another note,&lt;br /&gt;
If all checks are ok, I use PHP to move the file from tmp to /real_folder and to the name I define, which is always jpg. Then take the new moved file and use Imagick to resize and overwrite the file with the same name.&lt;/p&gt;
&lt;p&gt;If it wasn&#039;t changed by Imagick then I assume foul play and delete the image. I know that may be considered a bit hit and miss, but I know of people where file upload failed with this technique in place, and after investigating the files most contained JS, the others some other code like Java/ASP.&lt;/p&gt;
&lt;p&gt;I guess no way is 100% fool proof, but with all the checks and stopping code execution in the folder they reside I think it&#039;s pretty safe.&lt;/p&gt;
 </description>
     <pubDate>Fri, 13 Jun 2008 23:08:12 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1230608 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Hidden PHP code in the</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/image-upload-code#comment-1230607</link>
    <description> &lt;p&gt;Hidden &lt;a href=&quot;http://www.scanit.be/uploads/php-file-upload.pdf#page=9&quot;&gt;PHP code in the comments of the gif could be executed&lt;/a&gt; if the file extension is PHP. I guess if you recreate the image, those comments might be left out. But I only recreate the image if the image size is too high or wide. And I guess what greg said would prevent that too.&lt;/p&gt;
 </description>
     <pubDate>Fri, 13 Jun 2008 16:30:09 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1230607 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Checking the filename isn&#039;t</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/image-upload-code#comment-1230603</link>
    <description> &lt;p&gt;Checking the filename isn&#039;t really necessary if you check content &amp;amp; mime types.  I usually recreate the file extension based on the type anyway, for the people that use .jpeg instead of .jpg and .tiff instead .tif.&lt;/p&gt;
 </description>
     <pubDate>Fri, 13 Jun 2008 13:57:14 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1230603 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Thats all I check for.
I</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/image-upload-code#comment-1230589</link>
    <description> &lt;p&gt;Thats all I check for.&lt;/p&gt;
&lt;p&gt;I first use the PHP $_FILES [error] to quickly check for errors for a quick exit if any found, then run some more solid checks as you listed.&lt;/p&gt;
&lt;p&gt;I also use a htaccess in the images folder that prevents any scripts running.&lt;/p&gt;
 </description>
     <pubDate>Fri, 13 Jun 2008 04:27:14 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1230589 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
