RuoVea.OmiApi.Upload
8.0.0
dotnet add package RuoVea.OmiApi.Upload --version 8.0.0
NuGet\Install-Package RuoVea.OmiApi.Upload -Version 8.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RuoVea.OmiApi.Upload" Version="8.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RuoVea.OmiApi.Upload" Version="8.0.0" />
<PackageReference Include="RuoVea.OmiApi.Upload" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RuoVea.OmiApi.Upload --version 8.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RuoVea.OmiApi.Upload, 8.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RuoVea.OmiApi.Upload@8.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RuoVea.OmiApi.Upload&version=8.0.0
#tool nuget:?package=RuoVea.OmiApi.Upload&version=8.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RuoVea.OmiApi.Upload
介绍:
附件上传管理 API
文章分类和内容管理 API(RuoVea.OmiApi.Upload):基于.Net5.0 、.Net6.0 、.Net7.0、.Net8.0构建的简单、跨平台的系统。 系统业务简单、代码清晰,如果您只是单纯只需简单增、删、改、查。没有多余的功能,简单扩展下基本可以满足日常需求。 支持的数据库有 MySql、SqlServer、PostgreSQL、SQLite、Oracle...
安装教程
Install-Package RuoVea.OmiApi.Upload
/*类库映射API组件*/
if (builder.Environment.IsProduction())
{
builder.Services.AddDynamicWebApi(options =>
{
options.DefaultApiPrefix = "/openapi/api";
options.RemoveControllerPostfixes = new List<string> { "AppService", "Service" };
options.RemovePrefix = new List<string> { "get", "post" };
});
}
else
{
builder.Services.AddDynamicWebApi(options =>
{
options.RemoveControllerPostfixes = new List<string> { "AppService", "Service" };
options.RemovePrefix = new List<string> { "get", "post" };
});
}
builder.Services.AddOmiUploadSetup();/* 应用接口*/
builder.Services.AddSqlSugarSetup();/* 扩展ORM */
builder.Services.AddUploadInitSetup();/* 初始化表和种子数据 */
配置信息
{
"UploadConfig": {
/**
* 最大文件大小限制(字节)
* 默认值:10MB (10 * 1024 * 1024 = 10485760 字节)
* 用于限制用户上传文件的体积,防止服务器存储空间被大量占用
*/
"MaxFileSize": 10485760,
/**
* 允许的文件扩展名列表
* 用于白名单验证,只允许特定类型的文件上传
* 包含常见的图片、文档和文本文件格式
*/
"AllowedExtensions": [".jpg", ".jpeg", ".png", ".gif", ".pdf", ".doc", ".docx", ".txt"],
/**
* 允许的MIME类型列表
* 用于双重验证,防止文件扩展名欺骗
* 与AllowedExtensions对应的MIME类型,确保文件真实类型与扩展名匹配
*/
"AllowedMimeTypes": ["image/jpeg", "image/png", "image/gif", "application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "text/plain"],
/**
* 文件上传存储路径
* 相对路径,文件将存储在应用程序根目录下的此文件夹中
* 建议定期清理此目录以避免存储空间不足
*/
"UploadPath": "Uploads",
/**
* 是否使用原始文件名
* false:系统生成随机文件名(GUID),增强安全性,避免文件名冲突和注入攻击
* true:使用用户上传时的原始文件名(不推荐,存在安全风险)
*/
"UseOriginalFileName": false,
/**
* 文件名的最大长度限制(字符数)
* 用于防止过长的文件名导致系统路径问题
* 默认值:50个字符
*/
"MaxFileNameLength": 50,
/**
* 是否覆盖已存在的文件
* false:自动重命名新文件(添加数字后缀),避免覆盖现有文件
* true:覆盖同名文件(慎用,可能导致数据丢失)
*/
"OverwriteExisting": false
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- RuoVea.DynamicWebApi (>= 8.0.0)
- RuoVea.ExSugar (>= 8.0.0.20)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.