Upload Component - Manual upload

Hello there,

I would like to await the returned result of a file upload.
I have an exsisting Web API that saves an IFormFile to the database as bytes and saves information about that file (title, MIMI type etc) into another table.
This information is returned to the client.

        [Route("upload")]
        [HttpPost]
        public async Task<IActionResult> Upload(List<IFormFile> files)
        {
            var resourceInfos = await service.UploadResources(files);
            return Ok(resourceInfos);
        }

Your upload component performs the upload automaticly, I need a boolean that will prevent the automatic upload and a click event so that I can manually perform the upload.

Thanks,

Luke

I just see on your docs under the Description for Progess:

Upload Loaded, Total bytes and Percent as argument.

So does the UploadProgressArgs contain the returned response?

Hi @Luke_O_Brien,

We will add Auto property (true by default) to control if the the upload should start immediately or not. Upload() method will be added also to start manually the upload process. We will provide also Complete event with the response returned from server. The update will be available later today or tomorrow.

Hey thanks - That's great!
(No hurry)

Radzen.Blazor and the updated demo just published. Radzen release will follow! :slight_smile:

Thank that's really awesome - and all for little old me.

But in your haste I think you made some mistakes:
The Completed handler has a spelling mistake:

void Copmleted(UploadCompleteEventArgs args)
{
    events.Add(DateTime.Now, $"Server response: {args.RawResponse}");
}

And you have not attached to Completed or Error handlers to the Upload component in markup:

<RadzenUpload @ref="upload" Auto="false" Url="upload/single" Style="margin-bottom: 20px;"
              Progress="@((args) => OnProgress(args, "Manual Upload"))" />
<RadzenButton Text="Upload" Click="@(args => upload.Upload())" />

:wink:

I’ve fixed the typo, thanks. The event is attached to last Upload component only.

Ahh okay, didn't see that last one.
You know you could add the Complete to all of the components and remove the last one as it doesn't demonstrate anything different than the normal Upload.