protected static function getFilename($check)
    {
        if ($check instanceof UploadedFileInterface) {
            try {
                // Uploaded files throw exceptions on upload errors.
                return $check->getStream()->getMetadata('uri');
            } catch (RuntimeException $e) {
                return false;
            }
        }
        if (is_array($check) && isset($check['tmp_name'])) {
            return $check['tmp_name'];
        }

        if (is_string($check)) {
            return $check;
        }

        return false;
    }