FileUpload to server with custom data type

I have a FileController with an endpoint to upload one file by using a custom data type (I need some more data in addition to the file).

[HttpPost]
public async Task<IActionResult> UploadFile([FromForm] FileUploadDto fileUploadDto, [FromQuery] bool verbose)
{
    // do stuff
    return Ok(await fileCoordinator.Process(fileUploadDto, connectionInfo, verbose));
}

FileUploadDto has a member IFormFile File and 4 additional required string members.

I already checked Radzen Upload examples but the example Controller only accepts one IFormFile argument. I understand that it's possible to add additional query parameters and headers but I haven't found any info about using a custom type.

Another idea was to not call the endpoint, construct a FileUploadDto and directly call my FileCoordinator class in the Blazor page. But using RadzenUpload component without Url yields a FileInfo which cannot be converted into a IFormFile.

So, is there a way to use RadzenUpload with an endpoint that accepts a custom data type?

Hi @Kagemusha-san,

No, there isn't a way to submit a custom DTO to the endpoint specified via the Url property of RadzenUpload. The component only submits the file itself. A possible workaround is to use custom parameters as shown here: Blazor Upload Component | Free UI Components by Radzen

Hi @korchev ,
Thanks for the quick reply. This is the answer I was afraid of :wink: