class Download extends CI_Controller
{
public function index()
{
$this->load->model('Download_mod','',TRUE);
$type_xml = $this->input->post('type_xml', TRUE);
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'xml';
$config['max_size'] = '3000000';
$config['file_name'] = $type_xml."_".time();
$this->load->library('upload', $config);
$data['arr_transfer'] = $this->Download_mod->get_down();
if (! $this->upload->do_upload('file_content'))
{
if(!empty($_POST))
$data['error'] = $this->upload->display_errors();
else
$data['error'] = '';
$this->load->view('template',$data);
}
else
{
try {
$m_file = $this->upload->data();
$file = $m_file['full_path'];
if (file_exists($file))
{
$xml = simplexml_load_file($file);
$this->Download_mod->ins_xml($type_xml, $m_file, $xml);
unlink($file);
}
else
{
throw new Exception('Failed to open xml');
}
}
catch (Exception $e) {
}
redirect('/download/', 'location');
}
}
}
_____________
Что ты сделал сегодня - для завтра?"Приидите ко Мне вси труждающиеся и обремененнии и Аз упокою вы, возмите иго Мое на себе и научитеся от Мене яко кроток есмь и смирен сердцем и обрящете покой душам вашим, иго бо Мое благо и бремя Мое легко есть."(Мф. 11:28-30)