public function mimetype($acceptedMimetype)
    {
        is_true_or_fail($this->file, __d('me_tools', 'There are no uploaded file information'), RuntimeException::class);

        //Changes magic words
        switch ($acceptedMimetype) {
            case 'image':
                $acceptedMimetype = ['image/gif', 'image/jpeg', 'image/png'];
                break;
            case 'text':
                $acceptedMimetype = ['text/plain'];
                break;
        }

        $currentMimetype = mime_content_type($this->file->tmp_name);

        if (!in_array($currentMimetype, (array)$acceptedMimetype)) {
            $this->setError(__d('me_tools', 'The mimetype {0} is not accepted', $currentMimetype));
        }

        return $this;
    }
public function mimetype($acceptedMimetype)
    {
        is_true_or_fail($this->file, __d('me_tools', 'There are no uploaded file information'), RuntimeException::class);

        //Changes magic words
        switch ($acceptedMimetype) {
            case 'image':
                $acceptedMimetype = ['image/gif', 'image/jpeg', 'image/png'];
                break;
            case 'text':
                $acceptedMimetype = ['text/plain'];
                break;
        }

        $currentMimetype = mime_content_type($this->file->tmp_name);

        if (!in_array($currentMimetype, (array)$acceptedMimetype)) {
            $this->setError(__d('me_tools', 'The mimetype {0} is not accepted', $currentMimetype));
        }

        return $this;
    }
public function mimetype ( $ acceptedMimetype ) { is_true_or_fail ( $ this -> file , __d ( 'me_tools' , 'There are no uploaded file information' ) , RuntimeException :: class ) ; //Changes magic words switch ( $ acceptedMimetype ) { case 'image' : $ acceptedMimetype = [ 'image/gif' , 'image/jpeg' , 'image/png' ] ; break ; case 'text' : $ acceptedMimetype = [ 'text/plain' ] ; break ; } $ currentMimetype = mime_content_type ( $ this -> file -> tmp_name ) ; if ( ! in_array ( $ currentMimetype , ( array ) $ acceptedMimetype ) ) { $ this -> setError ( __d ( 'me_tools' , 'The mimetype {0} is not accepted' , $ currentMimetype ) ) ; } return $ this ; }
Checks if the mimetype is correct
@param string|array $acceptedMimetype Accepted mimetypes as string or
array or a magic word (`images` or `text`)
@return \MeTools\Controller\Component\UploaderComponent
@throws RuntimeException
@uses setError()
@uses $file
Checks if the mimetype is correct