Change the target name RadzenUpload

Hi Friends,

In RadzenUpload I want to change the target file name. But I could not succeed in the passing parameter to UploadControl. When I try to set URL property with querystring option (such as upload/single?${somevariable}), the component returns an error (do not support complex content).

I checked out the posts and samples.

The sample named "Upload with additional parameter" can be a solution. But I could not figure out how can fill the {1} in this sample.

Could you help me?
Thanks for your support,
KB

Hi, we updated the demo to show how to use a parameter in the Url property.

Hi @korchev

I checked out your sample again and this is exactly what I had been tried before. But I can't succeed. I can't pass the values to the controller.

Here is my basic code.

[HttpPost("upload/{Id}")]
public IActionResult Post(IFormFile file, int Id)
{
    try
    {
        Pages.AppSurveySetup appSurveySetup = new Pages.AppSurveySetup();
        Stream stream = file.OpenReadStream();
        var path = $"{Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")}\\UserFiles\\f_{Id}.xlsx";
        FileStream fs = System.IO.File.Create(path);
        stream.CopyToAsync(fs);
        stream.Close();
        fs.Close();

        return StatusCode(200);
    }
    catch (Exception ex)
    {
        return StatusCode(500, ex.Message);
    }
}

}

The "Id" is a page variable and predefined. Id returns 0 in this code. When I check OnProgress method the variable value is being correct.

Everything seems correct from my side. But I missed something.

Need help,

Thanks for your time,
KB

Hi @korchev ,

I found the reason.
When I declare the Url property in the Radzen, I had been used the default notation such as upload/{Id}. In this case, Radzen does not create a proper format in the generated code.

But when I wrote @($"upload/{Id}") line in the Url property everything is solved.

I'm learning the Radzen point of view. Which code is generated directly and which one is pre-processed must be known.

Thanks,