Improve error reporting when file upload is not configured properly
This commit is contained in:
@@ -33,7 +33,7 @@ class AvatarFileController extends BaseController
|
||||
$user = $this->getUser();
|
||||
|
||||
if (! $this->avatarFileModel->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) {
|
||||
$this->flash->failure(t('Unable to upload the file.'));
|
||||
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id'])));
|
||||
|
||||
@@ -33,12 +33,21 @@ class ProjectFileController extends BaseController
|
||||
public function save()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$result = $this->projectFileModel->uploadFiles($project['id'], $this->request->getFileInfo('files'));
|
||||
|
||||
if (! $this->projectFileModel->uploadFiles($project['id'], $this->request->getFileInfo('files'))) {
|
||||
$this->flash->failure(t('Unable to upload the file.'));
|
||||
if ($this->request->isAjax()) {
|
||||
if (! $result) {
|
||||
$this->response->json(array('message' => t('Unable to upload files, check the permissions of your data folder.')), 500);
|
||||
} else {
|
||||
$this->response->json(array('message' => 'OK'));
|
||||
}
|
||||
} else {
|
||||
if (! $result) {
|
||||
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])), true);
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('ProjectOverviewController', 'show', array('project_id' => $project['id'])), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,12 +52,21 @@ class TaskFileController extends BaseController
|
||||
public function save()
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$result = $this->taskFileModel->uploadFiles($task['id'], $this->request->getFileInfo('files'));
|
||||
|
||||
if (! $this->taskFileModel->uploadFiles($task['id'], $this->request->getFileInfo('files'))) {
|
||||
$this->flash->failure(t('Unable to upload the file.'));
|
||||
if ($this->request->isAjax()) {
|
||||
if (! $result) {
|
||||
$this->response->json(array('message' => t('Unable to upload files, check the permissions of your data folder.')), 500);
|
||||
} else {
|
||||
$this->response->json(array('message' => 'OK'));
|
||||
}
|
||||
} else {
|
||||
if (! $result) {
|
||||
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user