progress commit
This commit is contained in:
parent
c04b9ac6f2
commit
01fe86113d
1 changed files with 24 additions and 5 deletions
|
@ -8,6 +8,7 @@
|
|||
@using ImageBoardServerApp.Data.Repository
|
||||
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IWebHostEnvironment env
|
||||
|
||||
<div>
|
||||
<span>[</span>
|
||||
|
@ -95,14 +96,20 @@
|
|||
Console.WriteLine($"Smth changed!: {value}");
|
||||
}
|
||||
|
||||
private IBrowserFile selectedFile;
|
||||
|
||||
|
||||
private async Task SingleUpload(InputFileChangeEventArgs e)
|
||||
{
|
||||
/*
|
||||
MemoryStream ms = new MemoryStream();
|
||||
await e.File.OpenReadStream().CopyToAsync(ms);
|
||||
var bytes = ms.ToArray();
|
||||
image = bytes;
|
||||
Console.WriteLine("File has been selected!");
|
||||
ms.Close();
|
||||
ms.Close(); */
|
||||
selectedFile = e.GetMultipleFiles()[0];
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private Byte[] image;
|
||||
|
@ -133,6 +140,18 @@
|
|||
|
||||
//TODO Add check if data is image
|
||||
|
||||
if (selectedFile == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Stream stream = selectedFile.OpenReadStream(maxAllowedSize: 512000 * 4); // max 2MB
|
||||
var path = $"{env.WebRootPath}\\dynamic\\op\\{selectedFile.Name}";
|
||||
FileStream fs = File.Create(path);
|
||||
await stream.CopyToAsync(fs);
|
||||
stream.Close();
|
||||
fs.Close();
|
||||
|
||||
var imageToUpload = new ImageData
|
||||
{
|
||||
Board = board.Tag,
|
||||
|
|
Loading…
Reference in a new issue