<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Comments on snippet: 'Download file'</title>
<link>http://snipplr.com</link>
<description>Snipplr comments feed'</description>
<language>en-us</language>
<pubDate>Thu, 23 May 2013 06:03:42 GMT</pubDate>
<item>
<title>finalwebsites said on 4/28/11</title>
<link>http://snipplr.com/view/205/download-file/</link>
<description><![CDATA[ Nice snippet but you should replace the function "eregi()"

from the PHP manual:
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. ]]></description>
<pubDate>Thu, 28 Apr 2011 16:02:20 GMT</pubDate>
<guid>http://snipplr.com/view/205/download-file/</guid>
</item>
<item>
<title>zoranmk said on 10/27/10</title>
<link>http://snipplr.com/view/205/download-file/</link>
<description><![CDATA[ Why, don't you check the CodeIgniter download helper it has logic if we are dealing with Internet Explorer or other browser and it's probably more tested than this code.
The function name is force_download ]]></description>
<pubDate>Wed, 27 Oct 2010 21:40:41 GMT</pubDate>
<guid>http://snipplr.com/view/205/download-file/</guid>
</item>
<item>
<title>smartlogo said on 8/19/08</title>
<link>http://snipplr.com/view/205/download-file/</link>
<description><![CDATA[ lastly i fine it thanks ]]></description>
<pubDate>Tue, 19 Aug 2008 10:25:30 GMT</pubDate>
<guid>http://snipplr.com/view/205/download-file/</guid>
</item>
<item>
<title>NotIan said on 7/16/08</title>
<link>http://snipplr.com/view/205/download-file/</link>
<description><![CDATA[ <p>Since ereg is being phased out for PHP6 you should use preg_match, and you should be checking it on a per path chunk basis, ie:</p>

<p>$targetArray = explode('/',$filename);
foreach($targetArray as $key => $value){
  if(preg_match('/^(..|.ht).*/',$value){
    die('File Path Invalid');
  }
}</p>

<p>What if i have a file in:
ficheros/images/picture.htc.jpg
or
ficheros/filename..doc?</p>

<p>Also if you are not subdirectorying you could just use basename($filename) and be done with it</p> ]]></description>
<pubDate>Wed, 16 Jul 2008 12:57:06 GMT</pubDate>
<guid>http://snipplr.com/view/205/download-file/</guid>
</item>
<item>
<title>NotIan said on 7/16/08</title>
<link>http://snipplr.com/view/205/download-file/</link>
<description><![CDATA[ <p>Since ereg is being phased out for PHP6 you should use preg_match, and you should be checking it on a per path chunk basis, ie:</p>

<p>$targetArray = explode('/',$filename);
foreach($targetArray as $key => $value){
  if(preg_match('/^(..|.ht).*/',$value){
    die('File Path Invalid');
  }
}</p>

<p>What if i have a file in:
ficheros/images/picture.htc.jpg
or
ficheros/filename..doc?</p>

<p>Also if you are not subdirectorying you could just use basename($filename) and be done with it</p> ]]></description>
<pubDate>Wed, 16 Jul 2008 12:56:30 GMT</pubDate>
<guid>http://snipplr.com/view/205/download-file/</guid>
</item>
<item>
<title>koncept said on 4/22/08</title>
<link>http://snipplr.com/view/205/download-file/</link>
<description><![CDATA[ <p>Hey there. Just noticed that the script is killed on line 10 if '..' is detected in the filename string. As such, line #11's overhead is redundant — the condition will not be met.</p> ]]></description>
<pubDate>Tue, 22 Apr 2008 03:54:09 GMT</pubDate>
<guid>http://snipplr.com/view/205/download-file/</guid>
</item>
</channel>
</rss>