FileUploadTest.razor (538B)
1 @page "/FileUploadTest" 2 <h3>FileUploadTest</h3> 3 4 <InputFile OnChange="FilePicked" multiple="false"></InputFile> 5 6 7 @code { 8 9 private async void FilePicked(InputFileChangeEventArgs obj) 10 { 11 Console.WriteLine("FilePicked"); 12 Console.WriteLine(obj.File.Name); 13 Console.WriteLine(obj.File.Size); 14 Console.WriteLine(obj.File.ContentType); 15 var res = await RuntimeCache.CurrentHomeServer.UploadFile(obj.File.Name, obj.File.OpenReadStream(), obj.File.ContentType); 16 Console.WriteLine(res); 17 } 18 19 }