Upload file size limit configuration & handling
This commit is contained in:
@@ -304,6 +304,7 @@ class Proj extends Users_Controller {
|
||||
|
||||
$this->load->model('backend_model');
|
||||
|
||||
|
||||
if ($_POST && !isset($_POST['uploadForm'])) {
|
||||
$msgArray = array();
|
||||
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
||||
@@ -325,6 +326,8 @@ class Proj extends Users_Controller {
|
||||
|
||||
$data = $this->load_files($data, $jobID);
|
||||
|
||||
$data["sizeLimit"] = $this->backend_model->cfgReadChar("system.upload_size_limit");
|
||||
|
||||
$this->load->model('dash_model');
|
||||
$out = $this->dash_model->getDashData($data);
|
||||
$data['active_task'] = $out['active_task'];
|
||||
@@ -415,6 +418,8 @@ class Proj extends Users_Controller {
|
||||
$data = $this->load_files($data, $jobID);
|
||||
//$this->load_files($data, $jobID);
|
||||
|
||||
$data["sizeLimit"] = $this->backend_model->cfgReadChar("system.upload_size_limit");
|
||||
|
||||
$this->load->model('dash_model');
|
||||
$out = $this->dash_model->getDashData($data);
|
||||
$data['active_task'] = $out['active_task'];
|
||||
@@ -490,6 +495,8 @@ class Proj extends Users_Controller {
|
||||
|
||||
$data = $this->load_files($data, $jobID);
|
||||
|
||||
$data["sizeLimit"] = $this->backend_model->cfgReadChar("system.upload_size_limit");
|
||||
|
||||
if ($_POST && !isset($_POST['uploadForm'])) {
|
||||
$msgArray = array();
|
||||
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
||||
@@ -579,6 +586,8 @@ class Proj extends Users_Controller {
|
||||
|
||||
$data = $this->load_files($data, $jobID);
|
||||
|
||||
$data["sizeLimit"] = $this->backend_model->cfgReadChar("system.upload_size_limit");
|
||||
|
||||
if ($_POST && !isset($_POST['uploadForm'])) {
|
||||
$msgArray = array();
|
||||
$msgArray['message'] = trim($this->input->post('jobmessage'));
|
||||
@@ -1051,6 +1060,7 @@ class Proj extends Users_Controller {
|
||||
$result = "";
|
||||
$d_txt = "";
|
||||
$is_live = $this->backend_model->cfgReadChar("system.live");
|
||||
$sizeLimit = $this->backend_model->cfgReadChar("system.upload_size_limit");
|
||||
if ($this->input->post('contractId') == "" || (int) $_SESSION['member_id'] < 1) {
|
||||
$result = "Invalid contract or member ID";
|
||||
} else if (is_array($files)) {
|
||||
@@ -1062,7 +1072,8 @@ class Proj extends Users_Controller {
|
||||
foreach ($files["name"] as $key => $name) {
|
||||
if ($files["error"][$key] == 0) {
|
||||
$target_file = $target_dir . "/" . $name;
|
||||
if (move_uploaded_file($files["tmp_name"][$key], $target_file)) {
|
||||
if ($files["size"][$key] <= $sizeLimit
|
||||
&& move_uploaded_file($files["tmp_name"][$key], $target_file)) {
|
||||
$msgArray['action'] = WRENCHBOARD_CONTRACT_MESSAGE;
|
||||
$msgArray['message'] = $name;
|
||||
$msgArray['contract'] = $this->input->post('contractId');
|
||||
@@ -1096,6 +1107,10 @@ class Proj extends Users_Controller {
|
||||
$jobID = $this->input->post('jobID');
|
||||
$contractId = $this->input->post('contractId');
|
||||
|
||||
$this->load->model('backend_model');
|
||||
|
||||
$sizeLimit = $this->backend_model->cfgReadChar("system.upload_size_limit");
|
||||
|
||||
$files = array(
|
||||
"name" => array($_FILES["fileToUpload"]["name"]),
|
||||
"error" => array($_FILES["fileToUpload"]["error"]),
|
||||
@@ -1104,6 +1119,8 @@ class Proj extends Users_Controller {
|
||||
"type" => array($_FILES["fileToUpload"]["type"])
|
||||
);
|
||||
|
||||
$is_live = $this->backend_model->cfgReadChar("system.live");
|
||||
|
||||
list ($message, $uploaded) = $this->process_files($files);
|
||||
|
||||
if ($uploaded) {
|
||||
|
||||
Reference in New Issue
Block a user