Hey guys,
I am struggling for several hours with Upload component.
I tried a lot, but nothing works.
upload.upload() uploads just 128kb of 2Mb file.
I had to override RadzenUpload class and the javascript because I need every upload to go to unique folder (unique string is entered by user). I am passing unique string parameter to UploadCust method and from there to Radzen.upload javascript method. Everything works fine, except the file uploaded is broken and has only 128kb.
If you have any ideas what could be causing it, it would be helpful.
If needed, I can post my code.
Hi @Lucius_Agarthy,
Does the problem happen if you don't modify the Radzen.upload JS function? You can implement file uniqueness in the controller method itself. Here is how we do that in our online demos: radzen-blazor/RadzenBlazorDemos.Host/Controllers/UploadController.cs at d71d05374f4b8ccaa85c53316814589b8994fffb ยท radzenhq/radzen-blazor ยท GitHub
Hi Atanas,
thx for reply.
The solution you refer to was on my mind at first, but I do not know how to get Url ( return Ok(new { Url = url }); ) at my Index.razor component so I can process it further. I need to save unique path to files uploaded by user together with additional input data from user to DB. It is kind of product registration form, where user inputs unique serial number of product (I am validating uniqueness of SN against product DB). I thought I could use that unique SN as folder name, but upload function does not have this possibility, to pass additional parameter.
Original Radzen.upload works fine.
I do not like the idea to override Radzen JS.
Is there some other way around?
Lukas
You can pass parameters to the upload action. Check the demo (upload with additional parameter).
THX.
Didn't know how to use this one, but figured it out. It works.
I found what was causing damaged file. I was calling async function to manage file synchronously.
Thank you for your patience.
And thank you again for the great work you are doing.