From 5a6cd48df19e1d5daf3f70d06052271a8340b147 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 16 Jan 2016 22:03:59 -0500 Subject: Remove global --- app/Model/File.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'app/Model') diff --git a/app/Model/File.php b/app/Model/File.php index daade517..be62cdb3 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -263,14 +263,16 @@ class File extends Base public function uploadFiles($project_id, $task_id, $form_name) { try { - if (empty($_FILES[$form_name])) { + $file = $this->request->getFileInfo($form_name); + + if (empty($file)) { return false; } - foreach ($_FILES[$form_name]['error'] as $key => $error) { - if ($error == UPLOAD_ERR_OK && $_FILES[$form_name]['size'][$key] > 0) { - $original_filename = $_FILES[$form_name]['name'][$key]; - $uploaded_filename = $_FILES[$form_name]['tmp_name'][$key]; + foreach ($file['error'] as $key => $error) { + if ($error == UPLOAD_ERR_OK && $file['size'][$key] > 0) { + $original_filename = $file['name'][$key]; + $uploaded_filename = $file['tmp_name'][$key]; $destination_filename = $this->generatePath($project_id, $task_id, $original_filename); if ($this->isImage($original_filename)) { @@ -283,7 +285,7 @@ class File extends Base $task_id, $original_filename, $destination_filename, - $_FILES[$form_name]['size'][$key] + $file['size'][$key] ); } } -- cgit v1.2.3