Skip to content

Commit 4c4f1c2

Browse files
authored
Update file-sharing-tutorial-acs-chat.md
1 parent 03615db commit 4c4f1c2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

articles/communication-services/tutorials/file-sharing-tutorial-acs-chat.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The diagram shows a typical flow of a file sharing scenario for both upload and
5858

5959
You can follow the tutorial [Upload file to Azure Blob Storage with an Azure Function](/azure/developer/javascript/how-to/with-web-app/azure-function-file-upload) to write the backend code required for file sharing.
6060

61-
Once implemented, you can call this Azure Function inside the `uploadHandler` function to upload files to Azure Blob Storage. For the remaining of the tutorial, we assume you have generated the function using the tutorial for Azure Blob Storage linked previously.
61+
Once implemented, you can call this Azure Function inside the `handleAttachmentSelection` function to upload files to Azure Blob Storage. For the remaining of the tutorial, we assume you have generated the function using the tutorial for Azure Blob Storage linked previously.
6262

6363
### Securing your Azure Blob storage container
6464

@@ -200,7 +200,7 @@ const uploadOptions: AttachmentUploadOptions = {
200200
const attachmentSelectionHandler: AttachmentSelectionHandler = async (uploadTasks) => {
201201
for (const task of uploadTasks) {
202202
try {
203-
const uniqueFileName = `${task}-${v4()}-${task.file?.name}`;
203+
const uniqueFileName = `${v4()}-${task.file?.name}`;
204204
const url = await uploadFileToAzureBlob(task);
205205
task.notifyUploadCompleted(uniqueFileName, url);
206206
} catch (error) {
@@ -292,6 +292,10 @@ const attachmentSelectionHandler: AttachmentSelectionHandler = async (uploadTask
292292
}
293293
}
294294
}
295+
296+
export const attachmentUploadOptions: AttachmentUploadOptions = {
297+
handleAttachmentSelection: attachmentSelectionHandler
298+
};
295299
```
296300
297301
## File downloads - advanced usage
@@ -357,7 +361,7 @@ const customHandler = = async (attachment: AttachmentMetadata, message?: ChatMes
357361
}
358362
```
359363
360-
Download errors are displayed to users in an error bar on top of the Chat Composite.
364+
If there were any issues during the download and the user needs to be notified, we can just `throw` an error with a message in the `onClick` function then the message would be shown in the error bar on top of the Chat Composite.
361365
362366
![File Download Error](./media/download-error.png "Screenshot that shows the File Download Error.")
363367

0 commit comments

Comments
 (0)