Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,16 @@ The [AttachmentRemoved](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.
{% highlight c# tabtitle="Attachment-remove.cs" %}
{% include code-snippet/ai-assistview/events/attachment-remove/attachment-remove.cs %}
{% endhighlight %}
{% endtabs %}
{% endtabs %}

## attachmentClick
The `AttachmentClick` event is triggered when an attached file is clicked in the AI AssistView.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/ai-assistview/events/attachmentClick/razor %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentClick.cs" %}
{% include code-snippet/ai-assistview/events/attachmentClick/attachmentClick.cs %}
{% endhighlight %}
{% endtabs %}
16 changes: 15 additions & 1 deletion ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/file-attachments.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,18 @@ You can use the  `MaxFileSize` property to allowed a maximum file size of the u
{% endhighlight %}
{% endtabs %}

![FileSize](images/file-size.png)
![FileSize](images/file-size.png)

### Setting maximum count
Restrict how many files can be attached at once using `MaximumCount` property. The default value is `10`. If users select more than the allowed count, the maximum count reached error will be displayed.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/ai-assistview/file-attachments/maximumCount/razor %}
{% endhighlight %}
{% highlight c# tabtitle="MaximumCount.cs" %}
{% include code-snippet/ai-assistview/file-attachments/maximumCount/maximumCount.cs %}
{% endhighlight %}
{% endtabs %}

![MaximumCount](images/maximumCount.png)
11 changes: 10 additions & 1 deletion ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,13 @@ The [AttachmentRemoved](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/ai-assistview/events/attachment-remove/tagHelper %}
{% endhighlight %}
{% endtabs %}
{% endtabs %}

## attachmentClick
The `attachmentClick` event is triggered when an attached file is clicked in the AI AssistView.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/ai-assistview/events/attachmentClick/tagHelper %}
{% endhighlight %}
{% endtabs %}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,18 @@ You can use the  `maxFileSize` property to allowed a maximum file size of the u
{% endhighlight %}
{% endtabs %}

![FileSize](images/file-size.png)
![FileSize](images/file-size.png)

### Setting maximum count
Restrict how many files can be attached at once using `maximumCount` property. The default value is `10`. If users select more than the allowed count, the maximum count reached error will be displayed.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/ai-assistview/file-attachments/maximumCount/razor %}
{% endhighlight %}
{% highlight c# tabtitle="MaximumCount.cs" %}
{% include code-snippet/ai-assistview/file-attachments/maximumCount/maximumCount.cs %}
{% endhighlight %}
{% endtabs %}

![MaximumCount](images/maximumCount.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions ej2-asp-core-mvc/chat-ui/EJ2_ASP.MVC/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,68 @@ The [UserTyping](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Int
{% include code-snippet/chat-ui/events/userTyping/userTyping.cs %}
{% endhighlight %}
{% endtabs %}

## Before attachment upload

The `BeforeAttachmentUpload` event is triggered before attached files begin uploading in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/beforeAttachmentUpload/razor %}
{% endhighlight %}
{% highlight c# tabtitle="BeforeAttachmentUpload.cs" %}
{% include code-snippet/chat-ui/events/beforeAttachmentUpload/beforeAttachmentUpload.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment upload success

The `AttachmentUploadSuccess` event is triggered when an attached file is successfully uploaded in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentUploadSuccess/razor %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentUploadSuccess.cs" %}
{% include code-snippet/chat-ui/events/attachmentUploadSuccess/attachmentUploadSuccess.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment upload failure

The `AttachmentUploadFailure` event is triggered when an attached file upload fails in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentUploadFailure/razor %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentUploadFailure.cs" %}
{% include code-snippet/chat-ui/events/attachmentUploadFailure/attachmentUploadFailure.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment removed

The `AttachmentRemoved` event is triggered when an attached file is removed from the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentRemoved/razor %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentRemoved.cs" %}
{% include code-snippet/chat-ui/events/attachmentRemoved/attachmentRemoved.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment click

The `AttachmentClick` event is triggered when an attached file is clicked in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentClick/razor %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentClick.cs" %}
{% include code-snippet/chat-ui/events/attachmentClick/attachmentClick.cs %}
{% endhighlight %}
{% endtabs %}
150 changes: 150 additions & 0 deletions ej2-asp-core-mvc/chat-ui/EJ2_ASP.MVC/file-attachments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
layout: post
title: Attachments in ##Platform_Name## Chat UI Control | Syncfusion
description: Checkout and learn about Attachments in Syncfusion ##Platform_Name## Chat UI control of Syncfusion Essential JS 2 and more.
platform: ej2-asp-core-mvc
control: Chat UI
publishingplatform: ##Platform_Name##
documentation: ug
---

# File Attachments in ##Platform_Name## Chat UI control

The Chat UI control supports message attachments, enabling users to upload and send files (images, documents, and more) alongside messages for richer, more contextual conversations. Enable this functionality using the `EnableAttachments` property and customize the behavior through the `AttachmentSettings` configuration.

## Enable file attachments

Enable file attachment support by setting the `EnableAttachments` property to `true`. By default, it is `false`.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/enableAttachments/razor %}
{% endhighlight %}
{% highlight c# tabtitle="EnableAttachments.cs" %}
{% include code-snippet/chat-ui/file-attachments/enableAttachments/enableAttachments.cs %}
{% endhighlight %}
{% endtabs %}

## Configure attachment settings

Use the `AttachmentSettings` property to customize file attachment behavior, including upload endpoints, file type restrictions, and size limits.

### Setting saveUrl and removeUrl

Set the `SaveUrl` and `RemoveUrl` properties to specify server endpoints for handling file uploads and removals. The `SaveUrl` processes file uploads, while the `RemoveUrl` handles file deletion requests.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/save-remove-url/razor %}
{% endhighlight %}
{% highlight c# tabtitle="saveRemoveUrl.cs" %}
{% include code-snippet/chat-ui/file-attachments/save-remove-url/saveRemoveUrl.cs %}
{% endhighlight %}
{% endtabs %}

### Setting file type

Use the `AllowedFileTypes` property to specify which file types users can upload. This property accepts file extensions (e.g., '.pdf', '.docx') or MIME types to control the types of files that can be attached.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/allowedFileTypes/razor %}
{% endhighlight %}
{% highlight c# tabtitle="AllowedFileTypes.cs" %}
{% include code-snippet/chat-ui/file-attachments/allowedFileTypes/allowedFileTypes.cs %}
{% endhighlight %}
{% endtabs %}

### Setting file size

Configure the `MaxFileSize` property to define the maximum file size allowed for uploads. Specify the size in bytes. The default value is `30000000` bytes (approximately 30 MB). Files exceeding this limit will not be uploaded.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/maxFileSize/razor %}
{% endhighlight %}
{% highlight c# tabtitle="MaxFileSize.cs" %}
{% include code-snippet/chat-ui/file-attachments/maxFileSize/maxFileSize.cs %}
{% endhighlight %}
{% endtabs %}

![MaxFileSize](images/maxFileSize.png)

### Setting save format

Control the format used to send files to the server using the `SaveFormat` property when path is not set. It does not change how files are uploaded. The default value is `Blob`.

- `Blob`: Used for fast, memory‑efficient local previews.
- `Base64`: Reads the file as a Base64 data URL, useful when you need an inline data URL.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/saveFormat/razor %}
{% endhighlight %}
{% highlight c# tabtitle="SaveFormat.cs" %}
{% include code-snippet/chat-ui/file-attachments/saveFormat/saveFormat.cs %}
{% endhighlight %}
{% endtabs %}

### Setting server path

The `Path` property to specifies the public base URL where uploaded files are (or will be) hosted. When set, it takes precedence over saveFormat.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/path/razor %}
{% endhighlight %}
{% highlight c# tabtitle="Path.cs" %}
{% include code-snippet/chat-ui/file-attachments/path/path.cs %}
{% endhighlight %}
{% endtabs %}

### Enabling drag-and-drop

Toggle drag-and-drop support for attachments via `EnableDragAndDrop` property. The default value is `true`.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/drag-and-drop/razor %}
{% endhighlight %}
{% highlight c# tabtitle="DragAndDrop.cs" %}
{% include code-snippet/chat-ui/file-attachments/drag-and-drop/dragAndDrop.cs %}
{% endhighlight %}
{% endtabs %}

### Setting maximum count

Restrict how many files can be attached at once using `MaximumCount`. The default value is `10`. If users select more than the allowed count, the maxfileSize error will be displayed.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/maximumCount/razor %}
{% endhighlight %}
{% highlight c# tabtitle="MaximumCount.cs" %}
{% include code-snippet/chat-ui/file-attachments/maximumCount/maximumCount.cs %}
{% endhighlight %}
{% endtabs %}

![MaximumCount](images/maximumCount.png)

## Templates

### Customizing the file preview

Provide a custom UI for previewing selected files using `PreviewTemplate`. Use this to render thumbnails, filenames, progress, remove buttons, or any additional metadata prior to sending.

### Customizing the attachments

Control how attachments appear inside message bubbles with `AttachmentTemplate`. Use this to tailor the display of images, documents, or custom file types once the message is posted.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/file-attachments/template/razor %}
{% endhighlight %}
{% highlight c# tabtitle="Template.cs" %}
{% include code-snippet/chat-ui/file-attachments/template/template.cs %}
{% endhighlight %}
{% endtabs %}

![AttachmentTemplate](images/attachmentTemplate.png)
![PreviewTemplate](images/previewTemplate.png)
65 changes: 65 additions & 0 deletions ej2-asp-core-mvc/chat-ui/EJ2_ASP.NETCORE/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,68 @@ The [userTyping](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.In
{% include code-snippet/chat-ui/events/userTyping/userTyping.cs %}
{% endhighlight %}
{% endtabs %}

## Before attachment upload

The `beforeAttachmentUpload` event is triggered before attached files begin uploading in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/beforeAttachmentUpload/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="BeforeAttachmentUpload.cs" %}
{% include code-snippet/chat-ui/events/beforeAttachmentUpload/beforeAttachmentUpload.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment upload success

The `attachmentUploadSuccess` event is triggered when an attached file is successfully uploaded in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentUploadSuccess/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentUploadSuccess.cs" %}
{% include code-snippet/chat-ui/events/attachmentUploadSuccess/attachmentUploadSuccess.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment upload failure

The `attachmentUploadFailure` event is triggered when an attached file upload fails in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentUploadFailure/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentUploadFailure.cs" %}
{% include code-snippet/chat-ui/events/attachmentUploadFailure/attachmentUploadFailure.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment removed

The `attachmentRemoved` event is triggered when an attached file is removed from the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentRemoved/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentRemoved.cs" %}
{% include code-snippet/chat-ui/events/attachmentRemoved/attachmentRemoved.cs %}
{% endhighlight %}
{% endtabs %}

## Attachment click

The `attachmentClick` event is triggered when an attached file is clicked in the Chat UI.

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/chat-ui/events/attachmentClick/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="AttachmentClick.cs" %}
{% include code-snippet/chat-ui/events/attachmentClick/attachmentClick.cs %}
{% endhighlight %}
{% endtabs %}
Loading