summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-16 22:03:59 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-16 22:03:59 -0500
commit5a6cd48df19e1d5daf3f70d06052271a8340b147 (patch)
tree8f022538279d6083adfb3f434a457e56870db370 /app/Model
parent47e427457930db38030e1a10e0f3d97a71473371 (diff)
Remove global
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/File.php14
1 files changed, 8 insertions, 6 deletions
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]
);
}
}