Files
radzen-blazor/RadzenBlazorDemos/Pages/UploadFromCode.razor
Atanas Korchev 41db785c31 Move Upload demo to /upload and rename upload API to api/upload
The Upload component demo was served at /example-upload because the demo
host's UploadController owned the /upload URL space. Move the controller's
endpoints under api/upload/* to free /upload, point the demo page and every
consumer (Upload and HtmlEditor demos) at the new paths, switch the page
route and ExampleService path to /upload, and add a permanent 301 redirect
from /example-upload (and the legacy docs URL) to /upload.
2026-06-23 12:45:15 +03:00

31 lines
991 B
Plaintext

<RadzenCard Variant="Variant.Outlined">
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Select a file to upload and click Upload</RadzenText>
<RadzenUpload @ref="upload" Auto="false" Multiple="true" Url="api/upload/multiple" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "select file" }})"
Progress=@OnProgress Style="width: 100%" />
<RadzenButton Text="Upload" Click=@OnUpload class="rz-mt-4" />
</RadzenCard>
<EventConsole @ref=@console />
@code {
EventConsole console;
RadzenUpload upload;
void OnUpload()
{
upload.Upload();
}
void OnProgress(UploadProgressArgs args)
{
console.Log($"Upload progress: {args.Progress}% / {args.Loaded} of {args.Total} bytes.");
if (args.Progress == 100)
{
foreach (var file in args.Files)
{
console.Log($"Uploaded: {file.Name} / {file.Size} bytes");
}
}
}
}