Initial import
This commit is contained in:
29
application/controllers/tools/Xphoto.php
Normal file
29
application/controllers/tools/Xphoto.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class Xphoto extends MY_Controller
|
||||
{
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
function download() {
|
||||
$temp_file = tempnam(sys_get_temp_dir(), 'x-photo-') . "tar.gz";
|
||||
if ( file_exists($temp_file) ) unlink($temp_file);
|
||||
$cmd="tar -zcf $temp_file -C /home/one/project/one/one-media/one-photo/ patient";
|
||||
exec($cmd);
|
||||
if (file_exists($temp_file)) {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="'.basename($temp_file).'"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($temp_file));
|
||||
readfile($temp_file);
|
||||
unlink($temp_file);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user