Welcome Guest, Not a member yet? Register   Sign In
ci 2.0 - large file downloads
#8

[eluser]MVUG[/eluser]
[quote author="Twisted1919" date="1297968822"]you can force download of any file with this code, doesn't matter it's size:
Code:
$file_name='download-me.zip';
        $file_path=FCPATH.'downloads/'.$file_name;

        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=download-item-'.$file_name);
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file_path));
        ob_clean();
        flush();
        readfile($file_path);
        exit;


Your helper, assumes that $filename is a full path to the file, which is okay, but you also set this name when the file is downloaded, as far as i can see, so i don't agree this. (downloading something like /var/www/public_html/downloads/download-me.zip as filename can only mean a security issue)[/quote]

Yeah your right, I try to fix this tonight... Also test your code! Thanx btw!


Messages In This Thread
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 02:06 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 05:50 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 06:02 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 06:06 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 06:10 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 06:45 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 06:53 AM
ci 2.0 - large file downloads - by El Forum - 02-17-2011, 07:06 AM
ci 2.0 - large file downloads - by El Forum - 02-28-2011, 12:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB