Repository: streamlit/streamlit
File: lib/streamlit/elements/widgets/file_uploader.py (Python)

Code before:
            default_value=None,
            writes_allowed=False,
        )
        maybe_raise_label_warnings(label, label_visibility)

        element_id = compute_and_register_element_id(
            "file_uploader",
            user_key=key,
            key_as_main_identity=False,
            dg=self.dg,
            label=label,
            type=type,
            accept_multiple_files=accept_multiple_files,
            help=help,
            width=width,
        )

        normalized_type = normalize_upload_file_type(type) if type else None

        file_uploader_proto = FileUploaderProto()
        file_uploader_proto.id = element_id
        file_uploader_proto.label = label
        file_uploader_proto.type[:] = (
            normalized_type if normalized_type is not None else []
        )
        file_uploader_proto.max_upload_size_mb = config.get_option(
            max_size if max_size is not None else config.get_option("server.maxUploadSize")
        )
        # Handle directory uploads - they should enable multiple files and set the directory flag
        is_directory_upload = accept_multiple_files == "directory"
        file_uploader_proto.multiple_files = (
            accept_multiple_files is True or is_directory_upload
        )
        file_uploader_proto.accept_directory = is_directory_upload
        file_uploader_proto.form_id = current_form_id(self.dg)
        file_uploader_proto.disabled = disabled
        file_uploader_proto.label_visibility.value = get_label_visibility_proto_value(
            label_visibility
        )

        if help is not None:
            file_uploader_proto.help = dedent(help)

        serde = FileUploaderSerde(accept_multiple_files, allowed_types=normalized_type)

        # FileUploader's widget value is a list of file IDs
        # representing the current set of files that this uploader should
        # know about.
        widget_state = register_widget(
            file_uploader_proto.id,
            on_change_handler=on_change,

Review comment (suggestion):
I think you used `config.get_option` here twice by mistake – if I'm setting `max_size=100`, it tried to get the config option `"100"`. 

Code after:
        help: str | None = None,
        on_change: WidgetCallback | None = None,
        args: WidgetArgs | None = None,
        kwargs: WidgetKwargs | None = None,
        *,  # keyword-only arguments:
        max_upload_size: int | None = None,
        label_visibility: LabelVisibility = "visible",
        disabled: bool = False,
        ctx: ScriptRunContext | None = None,
        width: WidthWithoutContent = "stretch",
    ) -> UploadedFile | list[UploadedFile] | None:
        key = to_key(key)

        # Validate max_upload_size early to provide a clear error message
        if max_upload_size is not None and (
            not isinstance(max_upload_size, int) or max_upload_size <= 0
        ):
            raise StreamlitAPIException(
                "The `max_upload_size` parameter must be a positive integer "
                "representing the maximum file size in megabytes, or None "
                "to fall back to the `server.maxUploadSize` configuration option."
            )

        check_widget_policies(
            self.dg,
            key,
            on_change,
            default_value=None,
            writes_allowed=False,
        )
        maybe_raise_label_warnings(label, label_visibility)

        element_id = compute_and_register_element_id(
            "file_uploader",
            user_key=key,
            max_upload_size=max_upload_size,
            # Treat the provided key as the main identity; only include changes
            # to the type, accept_multiple_files, and max_upload_size parameters
            # in the identity computation as those can invalidate the current
            # value
            key_as_main_identity={"type", "accept_multiple_files", "max_upload_size"},
            dg=self.dg,
            label=label,
            type=type,
            accept_multiple_files=accept_multiple_files,
            help=help,
            width=width,
        )

        normalized_type = normalize_upload_file_type(type) if type else None