getValue('mimetype')); if ($exploded_mime[0] != "image") { $form_state->setErrorByName( 'mimetype', t('Please enter an image mimetype (e.g. image/jpeg, image/png, etc...)') ); } } }