protected function validateFile (UploadedFile $handle)
    {
        $maxSize = 200000000;
        $extensions = 'application/jar,application/apk,application/octet-stream,application/zip';
        $fileConstraint = new File();
        $fileConstraint->maxSize = $maxSize;
        $fileConstraint->mimeTypes = explode( ',',  $extensions);

        $errors = $this->container->get('validator')->validateValue($handle, $fileConstraint);

        if (count($errors) == 0) {
            return true;
        } else {
            return $this->container->get('translator')
                ->trans(/** @Ignore */$errors[0]->getMessageTemplate(), $errors[0]->getMessageParameters());
        }
    }
protected function validateFile (UploadedFile $handle)
    {
        $maxSize = 200000000;
        $extensions = 'application/jar,application/apk,application/octet-stream,application/zip';
        $fileConstraint = new File();
        $fileConstraint->maxSize = $maxSize;
        $fileConstraint->mimeTypes = explode( ',',  $extensions);

        $errors = $this->container->get('validator')->validateValue($handle, $fileConstraint);

        if (count($errors) == 0) {
            return true;
        } else {
            return $this->container->get('translator')
                ->trans(/** @Ignore */$errors[0]->getMessageTemplate(), $errors[0]->getMessageParameters());
        }
    }
protected function validateFile ( UploadedFile $ handle ) { $ maxSize = 200000000 ; $ extensions = 'application/jar,application/apk,application/octet-stream,application/zip' ; $ fileConstraint = new File ( ) ; $ fileConstraint -> maxSize = $ maxSize ; $ fileConstraint -> mimeTypes = explode ( ',' , $ extensions ) ; $ errors = $ this -> container -> get ( 'validator' ) -> validateValue ( $ handle , $ fileConstraint ) ; if ( count ( $ errors ) == 0 ) { return true ; } else { return $ this -> container -> get ( 'translator' ) -> trans ( /** @Ignore */ $ errors [ 0 ] -> getMessageTemplate ( ) , $ errors [ 0 ] -> getMessageParameters ( ) ) ; } }
Validates file and return true on success and
array of error messages on failure

@param UploadFile $handle
@return boolean | string
Validates file and return true on success and array of error messages on failure