From 2072ba5744383b06ebd73e1a097df28340494a09 Mon Sep 17 00:00:00 2001 From: Ruben Date: Mon, 12 Sep 2016 17:59:41 +0100 Subject: [PATCH] Keep Id and better error --- src/Api/ScoreControllerProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Api/ScoreControllerProvider.php b/src/Api/ScoreControllerProvider.php index e9b6d2c..4983522 100644 --- a/src/Api/ScoreControllerProvider.php +++ b/src/Api/ScoreControllerProvider.php @@ -160,12 +160,12 @@ class ScoreControllerProvider implements ControllerProviderInterface } } - foreach($request->files->all() as $file) { + foreach($request->files->all() as $id => $file) { /* @var $file \Symfony\Component\HttpFoundation\File\UploadedFile */ $filename = $file->getClientOriginalName(); $ext = $file->getClientOriginalExtension(); if($ext != 'jpg' || $file->getMimeType() != 'image/jpeg') { - return new JsonResponse(['success' => false, 'message' => "Image not image/jpeg but " . $file->getMimeType() . " (".$ext.")"], 400); + return new JsonResponse(['success' => false, 'message' => "Image not image/jpeg but " . $file->getMimeType() . " (".$ext.")" ], 400); } @@ -175,7 +175,7 @@ class ScoreControllerProvider implements ControllerProviderInterface list($hit_id, $part) = \explode('-', $id_string); if(!in_array($part, $valid_parts)) { - return new JsonResponse(['success' => false, 'message' => "unknown face part."], 400); + return new JsonResponse(['success' => false, 'message' => "unknown face part '$part'"], 400); } /* @var $hit Models\Hit */