Keep Id and better error

This commit is contained in:
Ruben 2016-09-12 17:59:41 +01:00
parent 0afa1297e9
commit 2072ba5744

View file

@ -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 */