Skip to main content
All docs
V25.1
  • DxAIChatFileUploadSettings.FileTypeFilter Property

    Specifies MIME types users can select in the Open File dialog.

    Namespace: DevExpress.AIIntegration.Blazor.Chat

    Assembly: DevExpress.AIIntegration.Blazor.Chat.v25.1.dll

    NuGet Package: DevExpress.AIIntegration.Blazor.Chat

    Declaration

    [Parameter]
    public List<string> FileTypeFilter { get; set; }

    Property Value

    Type Description
    List<String>

    A list of MIME file types available for selection.

    Remarks

    Set the FileUploadEnabled property to true to enable file upload operations for users.

    AI Chat - File Attachments

    Declare a DxAIChatFileUploadSettings object and use its FileTypeFilter to limit the range of file types that users can select in the Open File dialog. The <DxAIChat> component passes the property value to the accept attribute of the underlying HTML input element to filter files available for selection. See MIME types for more information about file types.

    Note

    Since the FileTypeFilter property filters available file types on the client side, we recommend that you perform server-side validation to introduce secure file upload operations.

    If you want to restrict file extensions without affecting the Open File dialog, use the AllowedFileExtensions property instead. This property validates files once a user selects them and displays errors if file extensions are not allowed.

    Refer to the DxAIChatFileUploadSettings class description for more information.

    Example

    The following code snippet activates the file upload functionality in Blazor AI Chat and configures validation rules for uploaded files:

    @using DevExpress.AIIntegration.Blazor.Chat
    
    <DxAIChat CssClass="demo-chat"
              FileUploadEnabled="true">
        <AIChatSettings>
            <DxAIChatFileUploadSettings MaxFileCount="2"
                                        MaxFileSize="20000"
                                        AllowedFileExtensions="@(new List<string> { ".jpg", ".pdf" })"
                                        FileTypeFilter="@(new List<string> { "image/*", "application/pdf"})" />
        </AIChatSettings>
    </DxAIChat>
    
    See Also