diff options
| author | Nala Ginrut <nalaginrut@gmail.com> | 2014-06-19 15:18:13 +0800 |
|---|---|---|
| committer | Nala Ginrut <nalaginrut@gmail.com> | 2014-06-19 15:18:13 +0800 |
| commit | bfd1db41367f7931016931a94cf1b67396481c79 (patch) | |
| tree | 2d696f2d8eca9ed2e4561c61c16584952d9f7b0b /app/Controller/File.php | |
| parent | d0944e682d5a3491f72c5b566248b87fbaff032a (diff) | |
| parent | efdc959c555872677e599d2ff12e1263d719f3f2 (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'app/Controller/File.php')
| -rw-r--r-- | app/Controller/File.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/Controller/File.php b/app/Controller/File.php index 1604ab13..3c8c32d1 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -24,6 +24,7 @@ class File extends Base $this->response->html($this->taskLayout('file_new', array( 'task' => $task, 'menu' => 'tasks', + 'max_size' => ini_get('upload_max_filesize'), 'title' => t('Attach a document') ))); } @@ -36,8 +37,14 @@ class File extends Base public function save() { $task = $this->getTask(); - $this->file->upload($task['project_id'], $task['id'], 'files'); - $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#attachments'); + + if ($this->file->upload($task['project_id'], $task['id'], 'files') === true) { + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#attachments'); + } + else { + $this->session->flashError(t('Unable to upload the file.')); + $this->response->redirect('?controller=file&action=create&task_id='.$task['id']); + } } /** @@ -104,6 +111,7 @@ class File extends Base */ public function remove() { + $this->checkCSRFParam(); $task = $this->getTask(); $file = $this->file->getById($this->request->getIntegerParam('file_id')); |
