Index: branches/RC/kernel/units/helpers/file_helper.php =================================================================== diff -u -r9598 -r9616 --- branches/RC/kernel/units/helpers/file_helper.php (.../file_helper.php) (revision 9598) +++ branches/RC/kernel/units/helpers/file_helper.php (.../file_helper.php) (revision 9616) @@ -183,6 +183,22 @@ $this->Application->setUnitOption($prefix, 'Fields', $fields); $this->Application->setUnitOption($prefix, 'VirtualFields', $virtual_fields); } + + /** + * Downloads file to user + * + * @param string $filename + */ + function DownloadFile($filename) + { + $content_type = function_exists('mime_content_type') ? mime_content_type($filename) : 'application/octet-stream'; + + header('Content-type: '.$content_type); + header('Content-Disposition: attachment; filename="'.basename($filename).'"'); + header('Content-Length: '.filesize($filename)); + readfile($filename); + flush(); + } } ?> \ No newline at end of file