Hello,
I have the following Razor file:
```
@implements IAsyncDisposable
<Syncfusion.Blazor.Inputs.SfUploader @ref="_subject" ID="files" AllowMultiple="false">
<Syncfusion.Blazor.Inputs.UploaderEvents
FileSelected="@OnSelected"
/>
...
</Syncfusion.Blazor.Inputs.SfUploader>
@code
{
SfUploader? _subject = default!;
FileInfo? Current { get; set; }
async Task OnSelected(SelectedEventArgs parameter)
{
switch (parameter.FilesData.Count)
{
case 0:
break;
case 1:
Current = parameter.FilesData.Single();
...
break;
default:
throw MultipleFilesDetectedException.Default;
}
}
public ValueTask DisposeAsync()
{
return _subject?.CancelAsync(Current?.Yield().ToArray() ?? Empty.Array<FileInfo>()).ToOperation() ?? ValueTask.CompletedTask;
}
}
```
In particular, the DisposeAsync call, where I check if a file is in progress and, if so, Cancel it. The documentation states that this will remove files, but that does not be the case for me. The remove URL is never called and the file remains on the server.
Is there another setting/call I should be using? I did try calling RemoveAsync explicitly but that didn't do anything either.
Thank you for any assistance/guidance you can provide.
Hi Mike,
The CancelAsync Stops the in-progress chunked upload based on the file data. When the file upload is canceled, the partially uploaded file is removed from the server. Please refer to the below-shared documentation for more details.
|
@using Syncfusion.Blazor.Inputs
<SfUploader MaxFileSize=104857600 @ref="_subject" ID="files" AllowMultiple="false"> <UploaderAsyncSettings SaveUrl=https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save RemoveUrl=https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove ChunkSize=500000></UploaderAsyncSettings> <UploaderEvents FileSelected="@OnSelected"></UploaderEvents> </SfUploader>
<button @onclick="@cancelAsyncHandler">Cancel</button>
@code {
SfUploader _subject = default!;
FileInfo Current { get; set; }
public async Task cancelAsyncHandler() { await _subject.CancelAsync(); }
async Task OnSelected(SelectedEventArgs parameter) {
} } |
Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorUploader-427882195
Kindly try the above sample and let us know if this meets your requirement. If we misunderstood the requirement, we request you to provide additional details about the requirement as mentioned below. This will help us validate the requirement further and provide you with a better solution.
If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
Udhaya Kumar D
Hi Udhaya,
Thank you for your reply. Can you confirm that the file gets removed during DisposeAsync? That seems to be the difference between your provided sample and mine and I am wondering if that is why Remove is not being called in my case.
Thank you for any continued assistance you can provide,
Michael
Hi Mike,
We request you to provide additional details about the query as mentioned below, This will help us validate the query further and provide you with a better solution.
1. Are you facing the issue in any particular scenario?
2. Is the File Upload component rendered within any other component or alone?
3. Issue reproducing runnable sample (or modify the previously shared sample).
4. Issue replication steps.
5. Video illustration of the issue.
Udhaya Kumar D
Hi @Udhaya,
Thank you for your patience in tracking this down with me. As it seems the solution that was provided demonstrates this issue not occurring, I took a look into it. However, it appears that the upload/remove URL are not local to the project:
Do you have a solution that references the local project for upload/remove? I can better track this down if so.
To be certain, the problem I am facing is not the `OnRemove` event handler getting called, but the server call to remove the file is not getting called on `CancelAsync`.
Thank you,
Michael
Hi Mike,
We are validating the requirement. We will update the further details in two business days (9th September 2022)
Regards,
Mohanraj M
Thank you for the update, Mohanraj. If it helps I am slammed here, too :D
Hi Mike,
Sorry for the inconvenience caused.
Due to complexity, We are still validating the requirement. We will update the further details in two business days (14th September 2022).
Regards,
Udhaya Kumar D
Hi Udhaya, thank you for the update. No worries on this side. Please take your time.
Thank you,
Michael
Hi Mike,
We have considered the reported issue as a bug from our end and will be fixed in our September 21st patch release. You can track the status of the issue by the below feedback link.
Feedback Link : https://www.syncfusion.com/feedback/37456/filedata-not-received-at-server-endpoint-in-remove-method
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
Regards,
Udhaya Kumar D
Woohoo! Thank you very much Udhaya and team that is good news. Your excellent service and support are appreciated!
Hi Mike,
Thanks for your appreciation. As we mentioned earlier we will include the fix for the issue in our September 21st patch release.
Udhaya Kumar D
Hi Mike,
Due to complexity we couldn’t include the fix for the issue “Filedata not received at server endpoint in Remove method”. We will include the fix in our upcoming Volume 3 Main release which is expected to be rolled out on the end of September 2022. We appreciate your patience until then.
Regard,
Yohapuja S
No worries Yohapuja. I appreciate the update and your efforts out there.
Hi Mike,
We have fixed the reported issue and the fix in the testing phase, we will include the 12th October 2022 weekly patch release.
Regards,
Udhaya Kumar D
Woohoo! That is good news. Thank you for your efforts out there Udhaya and team!
Hi Mike,
We have fixed your reported issue from our end in the latest 20.2.50 version. So, we suggest you upgrade to our latest version to resolve the current issue.
Please find the release notes here: https://blazor.syncfusion.com/documentation/release-notes/20.2.50?type=all#uploader
Regards,
Udhaya Kumar D