Change download logic
Hello,
Currently when i click download file your control automatically download it to user/Download folder and show me a popup to open it. It is possible to change this logic and Stop file to me downloaded in user/Download folder but still to have this popup in top right to open the file and folder? The idea is that the file will be in the cloud and I want to download it in selected folder. What happen currently is that file is downloaded from the cloud to selected folder and File Manager copy it to user/Download. That is not need.
I use this documentation: https://blazor.syncfusion.com/documentation/file-manager/data-binding#file-download-1
I can easy replace this logic to download file from the cloud to selected folder. but how to open download result popup that is in top right position in the image?
public void BeforeDownload(BeforeDownloadEventArgs<FileManagerDirectoryContent> args)
{
var downloadData = FileManagerService.Download(args.DownloadData.Path, args.DownloadData.Names, args.DownloadData.DownloadFileDetails.ToArray());
args.FileStream = downloadData.FileStream;
args.DownloadFileName = downloadData.FileDownloadName;
}Attachment: Screenshot_6_8628c50e.jpg
- A detailed explanation of your requirement.
- A pictorial representation (screenshot or illustration) showing the desired behavior.
- Information about how you're currently selecting the custom folder for downloads.
Regards,
Prasanth Madhaiyan.
Hello,
Actually you unerstand my requirement. But lets give you more clear picture.
From uploaded image: red box is file structure on HDD. Selected folder is Documents ( D:/Downloads/Documents ). Files do not exist on HDD. They are in the cloud. When I click Download button my logic download the file from cloud in D:/Downloads/Documents on my HDD. Then your logic continue to download/copy from D:/Downloads/Documents to
C:\Users\xxx\Downloads\ I can stop this of course but want to have download finish popup in blue rectangle in uploaded picture.
what I need is:
public void BeforeDownload(BeforeDownloadEventArgs<FileManagerDirectoryContent> args)
{
//my download logic from cloud to SelectedFolder: currently is D:/Downloads/Documents
//open download result popup without to copy file from D:/Downloads/Documents to C:\Users\xxx\Downloads\
}
Attachment: Screenshot_7_27559214.jpg
Regards,
Prasanth Madhaiyan.
That is good. How to trigger this box to show? You trigger it by somehow in your code.
... @using Syncfusion.Blazor.FileManager @using BlazorApp1 @inject Microsoft.AspNetCore.Components.NavigationManager UriHelper @inject FileManagerService FileManagerService <div class="control-section"> @* Initialization of default File Manager component *@ <SfFileManager TValue="FileManagerDirectoryContent" AllowDragAndDrop="true" ShowThumbnail="false" ShowFileExtension="false"> <FileManagerEvents TValue="FileManagerDirectoryContent" OnRead="OnReadAsync" ItemsDeleting="ItemsDeletingAsync" FolderCreating="FolderCreatingAsync" Searching="SearchingAsync" ItemRenaming="ItemRenamingAsync" ItemsMoving="ItemsMovingAsync" BeforeImageLoad="BeforeImageLoadAsync" BeforeDownload="BeforeDownload"></FileManagerEvents> </SfFileManager> </div> @code { ... public void BeforeDownload(BeforeDownloadEventArgs<FileManagerDirectoryContent> args) { var downloadData = FileManagerService.Download(args.DownloadData.Path, args.DownloadData.Names, args.DownloadData.DownloadFileDetails.ToArray()); args.FileStream = downloadData.FileStream; args.DownloadFileName = downloadData.FileDownloadName; } } |
Regards,
Prasanth Madhaiyan.
And the browser download the file automatically in Download folder?
Regards,
Prasanth Madhaiyan.
I not need this. I will make control that will match download result box design.
This dialog behavior is entirely dependent on the browser being used, and it may vary across different browsers. As a result, we are unable to customize or modify the appearance or behavior of the browser’s download dialog from our end.
Regards,
Prasanth Madhaiyan.
Hello,
Yes, don't worry about this.
Thank you
Hi Dimitar,
If you need any assistance related to our components, please let us know.
Regards,
Florence L.
- 11 Replies
- 3 Participants
-
DI Dimitar
- Apr 22, 2025 10:28 PM UTC
- Apr 30, 2025 08:16 AM UTC