Back to Devexpress

DxAIChatFileUploadSettings.AllowedFileExtensions Property

blazor-devexpress-dot-aiintegration-dot-blazor-dot-chat-dot-dxaichatfileuploadsettings-229c323b.md

latest2.6 KB
Original Source

DxAIChatFileUploadSettings.AllowedFileExtensions Property

Specifies file extensions the AI Chat component can upload.

Namespace : DevExpress.AIIntegration.Blazor.Chat

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

NuGet Package : DevExpress.AIIntegration.Blazor.Chat

Declaration

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

Property Value

TypeDescription
List<String>

A list of allowed file extensions.

|

Remarks

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

Once a user attaches a file to a message, the AI Chat component validates the file name extension. Declare a DxAIChatFileUploadSettings object and use its AllowedFileExtensions property to specify extensions of files that <DxAIChat> can upload. If validation fails, the component cannot upload this file and displays an error message.

Refer to the DxAIChatFileUploadSettings class description for additional information.

Example

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

razor
@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>

Run Demo: AI Chat - File Attachments

See Also

DxAIChatFileUploadSettings Class

DxAIChatFileUploadSettings Members

DevExpress.AIIntegration.Blazor.Chat Namespace