Overwrite default files on project creation
This commit is contained in:
@@ -55,10 +55,10 @@ class Projects extends CI_Controller {
|
|||||||
// run form validation
|
// run form validation
|
||||||
if ($this->form_validation->run() === true) {
|
if ($this->form_validation->run() === true) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'name' => $this->input->post('name'),
|
'name' => $this->input->post('name'),
|
||||||
'description' => $this->input->post('description'),
|
'description' => $this->input->post('description'),
|
||||||
'defaultmodel' => $modelData['file_name'],
|
'defaultmodel' => $modelData['file_name'],
|
||||||
'defaultconfig' => $configData['file_name'],
|
'defaultconfig' => $configData['file_name'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$data['project_id'] = $this->project->create($data);
|
$data['project_id'] = $this->project->create($data);
|
||||||
@@ -69,12 +69,13 @@ class Projects extends CI_Controller {
|
|||||||
mkdirs($projectPath);
|
mkdirs($projectPath);
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
'upload_path' => $projectPath,
|
'upload_path' => $projectPath,
|
||||||
'allowed_types' => '*',
|
'allowed_types' => '*',
|
||||||
|
'overwrite' => true,
|
||||||
);
|
);
|
||||||
$this->load->library('upload', $config);
|
$this->load->library('upload', $config);
|
||||||
|
|
||||||
if (!empty($_FILES['defaultmodel']['tmp_name'])) {
|
if ($_FILES['defaultmodel']['tmp_name'] != '') {
|
||||||
$config['file_name'] = 'defaultmodel';
|
$config['file_name'] = 'defaultmodel';
|
||||||
$this->upload->initialize($config);
|
$this->upload->initialize($config);
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ class Projects extends CI_Controller {
|
|||||||
$this->messages->add(_('The default model could not be uploaded.'), 'error');
|
$this->messages->add(_('The default model could not be uploaded.'), 'error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($_FILES['defaultconfig']['tmp_name'])) {
|
if ($_FILES['defaultconfig']['tmp_name'] != '') {
|
||||||
$config['file_name'] = 'defaultconfig';
|
$config['file_name'] = 'defaultconfig';
|
||||||
$this->upload->initialize($config);
|
$this->upload->initialize($config);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user