Large file streaming uploads

This commit is contained in:
Shaun Walker
2019-09-06 13:15:18 -04:00
parent 22420f2b43
commit a84eee8782
17 changed files with 305 additions and 13 deletions

View File

@ -0,0 +1,37 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Oqtane.Shared;
namespace Oqtane.Services
{
public class FileService : ServiceBase, IFileService
{
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
private readonly IJSRuntime jsRuntime;
public FileService(SiteState sitestate, IUriHelper urihelper, IJSRuntime jsRuntime)
{
this.sitestate = sitestate;
this.urihelper = urihelper;
this.jsRuntime = jsRuntime;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "File"); }
}
public async Task UploadFilesAsync(string Folder)
{
await UploadFilesAsync(Folder, "");
}
public async Task UploadFilesAsync(string Folder, string FileUploadName)
{
var interop = new Interop(jsRuntime);
await interop.UploadFiles(apiurl + "/upload", Folder, FileUploadName);
}
}
}