From f65be3c0d803d0be4c730a007ab0887e29682c34 Mon Sep 17 00:00:00 2001 From: Sam Spencer Date: Mon, 27 Jul 2015 21:01:43 -0400 Subject: [PATCH] When upload succeeds --- Controller/UploadsController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Controller/UploadsController.php b/Controller/UploadsController.php index c287666..9480734 100644 --- a/Controller/UploadsController.php +++ b/Controller/UploadsController.php @@ -58,16 +58,19 @@ public function upload($dir=null) { } if (sizeof($result) > 0) { - $this->set("result", htmlspecialchars(json_encode($result), ENT_NOQUOTES)); - $this->response->type('json'); + // There was an issue with the upload $this->response->statusCode(400); + } else { + // The upload was a success + $result = array('ok' => 'upload success'); + $this->response->statusCode(200); } + $this->response->type('json'); + $this->set("result", htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } /** - * * delete a file - * * Thanks to traedamatic @ github */ public function delete($file = null) {