{"action":"closed","issue":{"url":"https://api.github.com/repos/siriusphp/upload/issues/18","repository_url":"https://api.github.com/repos/siriusphp/upload","labels_url":"https://api.github.com/repos/siriusphp/upload/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/siriusphp/upload/issues/18/comments","events_url":"https://api.github.com/repos/siriusphp/upload/issues/18/events","html_url":"https://github.com/siriusphp/upload/issues/18","id":207796805,"number":18,"title":"When I upload image I the error message throws array","user":{"login":"mayurpande","id":6522456,"avatar_url":"https://avatars0.githubusercontent.com/u/6522456?v=3","gravatar_id":"","url":"https://api.github.com/users/mayurpande","html_url":"https://github.com/mayurpande","followers_url":"https://api.github.com/users/mayurpande/followers","following_url":"https://api.github.com/users/mayurpande/following{/other_user}","gists_url":"https://api.github.com/users/mayurpande/gists{/gist_id}","starred_url":"https://api.github.com/users/mayurpande/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayurpande/subscriptions","organizations_url":"https://api.github.com/users/mayurpande/orgs","repos_url":"https://api.github.com/users/mayurpande/repos","events_url":"https://api.github.com/users/mayurpande/events{/privacy}","received_events_url":"https://api.github.com/users/mayurpande/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-15T12:57:25Z","updated_at":"2017-03-07T16:25:51Z","closed_at":"2017-03-07T16:25:51Z","body":"I have written this on in my class;\r\n\r\n```\r\n<?php\r\n\r\nnamespace App\\Controllers;\r\n\r\nuse Sirius\\Upload\\Handler as UploadHandler;\r\n\r\n//import validator\r\nuse Respect\\Validation\\Validator as v;\r\n\r\nclass SiriusController extends Controller\r\n{\r\n\r\n\r\n\tpublic function getImageUpload($request,$response){\r\n\t\treturn $this->view->render($response,'admin-upload.twig');\r\n\t}\r\n\r\n    public function postImageUpload($request,$response){\r\n      $uploadHandler = new UploadHandler($_SERVER['DOCUMENT_ROOT'] . \"/img\");\r\n\r\n      // set up the validation rules\r\n      $uploadHandler->addRule('extension', ['allowed' => 'jpg', 'jpeg', 'png'], '{label} should be a valid image (jpg, jpeg, png)', 'Profile picture');\r\n      $uploadHandler->addRule('size', ['max' => '20M'], '{label} should have less than {max}', 'Profile picture');\r\n      $uploadHandler->addRule('imageratio', ['ratio' => 1], '{label} should be a sqare image', 'Profile picture');\r\n\r\n\r\n      $result = $uploadHandler->process($_FILES['upload']); // ex: subdirectory/my_headshot.png\r\n\r\n      if ($result->isValid()) {\r\n          try {\r\n\r\n              // do something with the image like attaching it to a model etc\r\n              $profile->picture = $result->name;\r\n              $profile->save();\r\n              $result->confirm(); // this will remove the .lock file\r\n              $this->flash->addMessage('success','Image uploaded');\r\n              $this->flash->addMessage('info','Make sure to add the same name i.e. image.jpg as a string in other form submission');\r\n              return $response->withRedirect($this->router->pathFor('admin.update'));\r\n\r\n          } catch (\\Exception $e) {\r\n\r\n              // something wrong happened, we don't need the uploaded files anymore\r\n              $result->clear();\r\n              throw $e;\r\n\r\n          }\r\n      } else {\r\n\r\n          // image was not moved to the container, where are error messages\r\n          $messages = $result->getMessages();\r\n          $this->flash->addMessage('error',$messages);\r\n          return $response->withRedirect($this->router->pathFor('admin.update'));\r\n\r\n      }\r\n    }\r\n}\r\n\r\n\r\n\r\n```\r\n\r\nHowever when I try to upload an image, the `$messages` prints out `Array` not sure what is going wrong?"}}
{"actor":{"display_login":"adrianmiu"}}