When i am executing UploadedFiles = await fileuploader.GetFilesDataAsync(); this line of code before
await fileuploader.UploadAsync(); // Upload the selected file manually then my uploaded files shows zero bytes means empty files
if i remove this line UploadedFiles = await fileuploader.GetFilesDataAsync(); then every this works fine but i want files uploaded list to save in database
here is my code
<SfUploader @ref="fileuploader" ID="UploadFiles" SequentialUpload="true" AllowedExtensions=".txt,.jpg,.jpeg,.png,.doc,.docx,.xls,.xlsx,.zip,.pdf,.PDF" AllowMultiple="true" AutoUpload="false">
<UploaderEvents ValueChange="OnChange"></UploaderEvents>
</SfUploader>
//C# Code
SfUploader? fileuploader = null;
private async Task SaveSupportTicket()
{
if (fileuploader != null)
{
UploadedFiles = await fileuploader.GetFilesDataAsync();
foreach (var upfile in UploadedFiles)
{
attachments.Add(upfile.Name);
}
supportTicket.AttachmentPath = String.Join(",", attachments.ToArray());
}
}
private void OnChange(UploadChangeEventArgs args)
{
try
{
foreach (var file in args.Files)
{
var path = Path.GetFullPath("wwwroot\\Attachments\\") + Path.GetFileNameWithoutExtension(file.FileInfo.Name) + "_" + selectedClient.CustomerID + "_" + (savedSupportTicket!=null ? savedSupportTicket.TicketNo : string.Empty) + Path.GetExtension(file.FileInfo.Name);
FileStream filestream = new FileStream(path, FileMode.Create, FileAccess.Write);
file.Stream.WriteTo(filestream);
filestream.Close();
file.Stream.Close();
}
}
catch (Exception)
{
throw;
}
}
Hi Dhiraj,
We have validated the requirement, when we are using the GetFilesDataAsync method we got the uploader selected file details. We have attached the validated sample in the attachment.
Find the screenshot here:
|
|
If still, you have faced the same issue, then please replicate the reported issue on the attached sample and revert us with a detailed issue replication procedure. These details will help us to provide an exact solution as earlier as possible.
Regards,
Sureshkumar P
I dont have issue in GetFilesDataAsync i have issue in upload files if use this GetFilesDataAsync and after that i upload files then files do not upload properly it shows zero bytes in files
Like this below code
UploadedFiles = await fileuploader.GetFilesDataAsync(); //If i comment this code then all working fine and if i dont comment it then files uploaded with zero bytes
await fileuploader.UploadAsync(); // Upload the selected file manually
Hi Dhiraj,
We have validated the modified code sample; we have faced no issues from our end.
Please find the screenshot for manual uploading the details of the selected file:
|
|
File uploading size
|
|
Regards,
Sureshkumar P
You are not understanding my issue i am not talking about code in code debug all is showing correct file name and file size after uploading files to specific folder it shows zero bytes in file explorer.
see screenshot in attachment
Hi Dhiraj,
We have updated the response in an incident under your account for this requirement # 405499. Please follow the ticket for further technical assistance.
Regards,
Sureshkumar P