I want to post a request to the upload controller with a dynamic URL upload/single/{perito_id}, but I am having dificulties defining this URL on the RadzenUpload component's.
I want to get the id from the database first and then pass it as a parameter to the controller, which I am doing on the page's load function:
Also, my upload's controller endpoint looks like this:
// Single file upload
[HttpPost("upload/single/{perito_id}")]
public async Task<IActionResult> SingleAsync(IFormFile file, int perito_id)
{
By doing this approach I get the error of Component attributes do not support complex content (mixed C# and markup). Attribute: 'Url', text: 'upload/single/{perito_id}'
Since the Services and the Controllers run on completely different threads, I can not fetch anything from the database on the Controller.
How do I go about passing a paramter to the UploadController, and while I'm at it, how could I possibily pass a informartion from the UploadController back to the view?
Hi , I can see your answer on this thread always is the same: "Here is how you should do it" but there is not any good example to follow. Once you are there to help the developers , please make a good and complete example to make the people to understand better how to operate with FileUploader.
Thank you.
What happens when you click the upload button? Do you see any HTTP request being made to your controller? Check your browser's developer tools (the network tab).
The fact that you see a request to your controller means that something happened - RadzenUpload tried to post the file to your controller which failed for some reason. Can you confirm that controllers are enabled in your application?
Yes I confirm.. the controller is active, it is in the same Blazor application.
Note: I get this problem once I added the secon parameter (docText) in the endpoint,
otherways it work perfectly.
So before the new parameter it work, after the I added the new parameter it stop working so the problem is the parameter.
I did try to change the parameter type to int instead of string and I can call the endpoint but the value is always 0 Zero.
This : in the URL before 1 seems wrong. Double check your URL construction logic. Other than that RadzenUpload seems to work as expected in your application and you have configuration / implementation problems that are unrelated.
Ok just please confirm that this is the correct way to pass parameter from the radzen uploader.
I will check again on how to pass parameter to the end point.
Please let me know: is there a way to intercept the url right before the uploader call the endpoint ?
Thank you.