public static function uploadError($check, $allowNoFile = false)
    {
        if ($check instanceof UploadedFileInterface) {
            $code = $check->getError();
        } elseif (is_array($check) && isset($check['error'])) {
            $code = $check['error'];
        } else {
            $code = $check;
        }
        if ($allowNoFile) {
            return in_array((int)$code, [UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE], true);
        }

        return (int)$code === UPLOAD_ERR_OK;
    }