【发布时间】:2020-12-10 14:00:23
【问题描述】:
Tusdotnet 是为使用 .NET 核心实现的文件上传而构建的,它的大小更大(如果卡住,它将从同一点恢复) .
- 上传文件的 ASP .NET Core 实现:
app.UseTus(httpContext => new DefaultTusConfiguration { // c:\tusfiles is where to store files Store = new TusDiskStore(@"C:\tusfiles\"), // On what url should we listen for uploads? UrlPath = "/files", Events = new Events { //OnFileCompleteAsync = eventContext => OnFileCompleteAsync = async eventContext => { //return Task.CompletedTask; ITusFile file = await eventContext.GetFileAsync(); if (file != null) { //Convert in to a FileStream //var fileStream = await file.GetContentAsync(httpContext.RequestAborted); } } } }
https://github.com/tusdotnet/tusdotnet
我需要问一下:
- 为了下载文件,我们需要编写自定义代码,但如何识别该级别的文件扩展名。
- 以及我们需要使用什么技术来下载文件,正如 Tusdotnet 所说,我们不负责下载文件。
【问题讨论】:
-
And what technique we need to use for download File, as Tusdotnet said we are not responsible for downloading the file您将文件存储在哪里? -
For download the file we need to write a custom code but how it will be possible to identify the file extension at that level.stackoverflow.com/questions/1886866/… -
上传文件我们使用上面的代码:参考:github.com/tusdotnet/tusdotnet
-
您在哪里存储文件?是 C:\tusfiles\?如果是这样,
app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider("c:\tusfiles\"), RequestPath = new PathString("/tusfiles") });是否有效? stackoverflow.com/a/31948829/34092 -
您是否尝试在文件上传完成后重命名?
标签: c# asp.net-core .net-core