BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
After uploading files to a specific location using SfUploader, the list of uploaded files was saved in db. I want to import the saved list later and create the list again. Is there a way to dynamically add UploaderUploadedFiles?
Also, is it possible to create a file list in the form of the table below based on the data we separately saved?
Hi junghwi,
Greetings from Syncfusion Support!
Query 1: Is there a way to dynamically add UploaderUploadedFiles
?
Yes, you can dynamically add files to the SfUploader
component using the UploadAsync
method. This method allows you to upload files programmatically. Here is the API reference for more details: UploadAsync Method.
Query 2: Is it possible to create a file list in the form of a table?
Yes, you can display the uploaded file items in a table format using the Template
property of the SfUploader
. This allows you to customize how the file list is rendered. For more information on using templates, please refer to the documentation here: Template Documentation.
You can also view a sample implementation here: Sample Link.
If you have any further questions or need additional assistance, feel free to reach out.
After uploading the file, the uploaded list is saved in the DB, and when selecting the grid, the saved file list must be retrieved again to create a list. (Download must also be possible. The screen structure we want is as shown in the image below.)
However, when I use UploadAsync in the code you sent, it looks like it is uploading again, and an error occurs.
Can't you just create a list without uploading the file?
Hello.
I am asking again because I have not received an answer to the question above.
Can I just create a list without uploading files?
Hi junghwi,
Thank you for reaching out and sorry for any inconvenience you are experiencing. We understand you want to display files stored in the database within the uploader when selecting a grid, without uploading them again.
We have created a simple sample that demonstrates how to display preloaded files dynamically. You can find the code snippet below:
<SfUploader @ref="Uploader" ShowFileList="true" AutoUpload="false" AllowedExtensions=".txt,.pdf,.jpg,.png"> <UploaderFiles> @foreach (var file in PreloadedFiles) { <UploaderUploadedFiles Name="@file.Name" Size="@file.Size" Type="@file.Type" /> } </UploaderFiles> </SfUploader> @code { private SfDialog UploaderDialog; private SfUploader Uploader; public class FileDetail { public string Name { get; set; } public long Size { get; set; } public string Type { get; set; } } // This will hold the files for the uploader private List<FileDetail> PreloadedFiles = new List<FileDetail> { new FileDetail { Name = "MyFile2", Size = 500000, Type = ".png" }, new FileDetail { Name = "MyFile1", Size = 600000, Type = ".png" } }; } |
Sample: https://blazorplayground.syncfusion.com/embed/LjVztltwsQZyPJoG?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5
In this example, we load a list of files into the component as preloaded files. Please review the sample to see if it meets your requirements. If it doesn't, feel free to reach out to us for further assistance.
Thank you for your answer.
However, it doesn't work as I want.
The functions I want are
1. After uploading a file, the list is displayed as in the image,
2. When selecting a list in the grid, the corresponding file list is displayed, and the file can be added to the list again.
This is the basic function I want to create.
If there is any source material that can be referenced, or if there are similar answers to previous questions, please let me know.
Hello.
When can I get an answer to this question??
(It's not easy to make it custom.)
Hi junghwi,
We understand that you want to display a list of uploaded files in a grid and be able to select an item from this list to see and re-add the file to the list.
To help you achieve this, we’ve created a basic sample demonstrating the functionality. In the sample, we show a table with user details and, upon selecting a user, a corresponding table displays their uploaded files with options to download them.
Here's a simplified example of how you can implement this:
<table class="table"> |
JavaScript:
function downloadFile(filename, content) { |
Please review the attached sample and video reference for a visual guide on
this implementation. Let us know if you have any further questions or need
additional assistance.
Regards,
Buvana S
Hi junghwi,
You are welcome. Please feel free to contact us if you have any further questions.
Regards,
Priyanka K