Has anyone else had a problem with removing files using TelerikUpload? Upload works fine, but when attempting to remove it hits the Remove method, but the files parameter is null. I have tried changing the parameter type from string to string[], IFormFile and IEnumerable<IFormFile>. I've tried changing the parameter name (and corresponding RemoveField), and nothing makes any difference. I can add a second, custom parameter, and that works ok. I just can't get a value for files.
Selected markup/code:
<TelerikUpload SaveUrl="@(AddDocumentApi())"
Multiple="true"
RemoveUrl="@(RemoveDocumentApi())"
OnUpload="OnUploadHandler"
OnRemove="OnRemoveHandler"
OnSuccess="OnSuccessHandler"
WithCredentials="true"
AllowedExtensions="@AllowedExtensions" />
public string RemoveDocumentApi() => $"{AddDocumentApiBase}/deletedocument";
[HttpPost("deletedocument")]
public async Task<IActionResult> DeleteDocument(string files)
{
// Hits a breakpoint here but files is null
return new EmptyResult();
}
Fixed this - I had to add [FromForm] before the parameter
public async Task<IActionResult> DeleteDocument([FromForm] string files)