30 lines
968 B
PHP
30 lines
968 B
PHP
<?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;
|
|
}
|
|
}
|
|
}
|