<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to check a file type efficiently in PHP?</title>
	<atom:link href="http://www.kadimi.com/en/file-type-265/feed" rel="self" type="application/rss+xml" />
	<link>http://www.kadimi.com/en/file-type-265</link>
	<description>[Web developper, Linux addict, Technical translator...]</description>
	<lastBuildDate>Sat, 07 Jan 2012 07:53:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: lifeofguenter</title>
		<link>http://www.kadimi.com/en/file-type-265#comment-144</link>
		<dc:creator>lifeofguenter</dc:creator>
		<pubDate>Sun, 02 Jan 2011 18:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.kadimi.com/en/?p=265#comment-144</guid>
		<description>using exec and not even escaping/validating/sanitizing inputs is just as bad - if not even worse, as users have now direct shell access.

I agree that using fileinfo extension (or any other pseudo type check like file/identify/whatever) should _only_ be used as pre-check. If you decide to host the uploaded file, always do an analog copy of the pixels. With this you are sure only to get the picture information and not any other files attached.</description>
		<content:encoded><![CDATA[<p>using exec and not even escaping/validating/sanitizing inputs is just as bad &#8211; if not even worse, as users have now direct shell access.</p>
<p>I agree that using fileinfo extension (or any other pseudo type check like file/identify/whatever) should _only_ be used as pre-check. If you decide to host the uploaded file, always do an analog copy of the pixels. With this you are sure only to get the picture information and not any other files attached.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nabil</title>
		<link>http://www.kadimi.com/en/file-type-265#comment-32</link>
		<dc:creator>Nabil</dc:creator>
		<pubDate>Sun, 09 Aug 2009 18:27:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.kadimi.com/en/?p=265#comment-32</guid>
		<description>Yes, using server software (specially antiviruses) will bring higher levels of security, but this is only available on dedicated servers.</description>
		<content:encoded><![CDATA[<p>Yes, using server software (specially antiviruses) will bring higher levels of security, but this is only available on dedicated servers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amine</title>
		<link>http://www.kadimi.com/en/file-type-265#comment-31</link>
		<dc:creator>Amine</dc:creator>
		<pubDate>Sun, 09 Aug 2009 10:07:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.kadimi.com/en/?p=265#comment-31</guid>
		<description>I prefer the &#039;file&#039; unix command because it relies on the header or signature of the file.

I think a good soluion for security would be to nest several tests both client side and server side, beginning from the simple check of the file extension, and going through some test like the one you exposed for checking the actual type of the file, and ending with a server side antivirus testing if the type of the file has been accepted. I&#039;m not a good php programmer but I think combining php functions and some other server scripting can lead to an acceptable solution.

Thank you for the answer!</description>
		<content:encoded><![CDATA[<p>I prefer the &#8216;file&#8217; unix command because it relies on the header or signature of the file.</p>
<p>I think a good soluion for security would be to nest several tests both client side and server side, beginning from the simple check of the file extension, and going through some test like the one you exposed for checking the actual type of the file, and ending with a server side antivirus testing if the type of the file has been accepted. I&#8217;m not a good php programmer but I think combining php functions and some other server scripting can lead to an acceptable solution.</p>
<p>Thank you for the answer!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

