RsCode.Storage.LocalStorage
1.3.2
See the version list below for details.
dotnet add package RsCode.Storage.LocalStorage --version 1.3.2
NuGet\Install-Package RsCode.Storage.LocalStorage -Version 1.3.2
<PackageReference Include="RsCode.Storage.LocalStorage" Version="1.3.2" />
paket add RsCode.Storage.LocalStorage --version 1.3.2
#r "nuget: RsCode.Storage.LocalStorage, 1.3.2"
// Install RsCode.Storage.LocalStorage as a Cake Addin #addin nuget:?package=RsCode.Storage.LocalStorage&version=1.3.2 // Install RsCode.Storage.LocalStorage as a Cake Tool #tool nuget:?package=RsCode.Storage.LocalStorage&version=1.3.2
开始使用 1.引用 RsCode.Storage.LocalStorage 2.配置 services.AddLocalStorage(Configuration);
appsettings.json中设置 //本地存储配置 "LocalStorage": { "UploadTokenUrl":"自定义的token获取地址", //例 /storage/uptoken "UploadUrl": "https://localhost:5001/storage/upload", "AccessKey": "",//不填 "SecretKey": "",//不填 "Domain": "上传后资源地址", //上传后资源地址,例:http://res.rscode.cn "Bucket": "", //不填 "Zone": "", //不填 "UploadTokenExpireTime": 30, // 上传token有效时间单位:秒 "DownloadTokenExpireTime": 5,//下载token有效时间 "ManageTokenExpireTime": 5 //管理token有效时间 }
3.自定义获取uptoken的逻辑 例: public class StorageController : Controller { public IActionResult UpToken([FromServices]IEnumerable<IStorageProvider> providers,string provider="local") { var qiniu = providers.FirstOrDefault(s ⇒ s.StorageName == provider); var tokenInfo= qiniu.GetUploadToken(); return Json(tokenInfo); } //本地上传逻辑 [HttpPost] public async Task<IActionResult> Upload([FromServices] IEnumerable<IStorageProvider> providers) { var local = providers.FirstOrDefault(s ⇒ s.StorageName == "local"); var tokenInfo= await local.UploadAsync(); return Json(tokenInfo); } }
上传token返回值: {domain:'合法域名',token:'上传token',upload_url:'上传地址'}
上传成功后的返回值 {res:'',key:'上传后的key'}
注意:使用本地上传时,在wwwroot文件夹中,确保保存文件的文件夹是存在的
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.4)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 3.1.4)
- RsCode.Storage (>= 1.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
本地服务器存储服务