├── .vs └── SecureFileUploadExtention │ ├── FileContentIndex │ ├── read.lock │ ├── 54659c04-a5eb-4de9-b0f3-8dde099c31a9.vsidx │ ├── 5c3c1000-1487-4cb0-ae85-30a5e13d0101.vsidx │ └── f452ea4c-1f49-4c96-a2ec-df2985f5b262.vsidx │ ├── v16 │ └── .suo │ └── v17 │ └── .suo ├── SecureFileUploadExtention ├── bin │ ├── Debug │ │ ├── UploadFileExtentions.1.0.0.nupkg │ │ ├── net5.0 │ │ │ ├── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.pdb │ │ │ ├── ref │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ └── SecureFileUploadExtention.deps.json │ │ └── net6.0 │ │ │ ├── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.pdb │ │ │ └── SecureFileUploadExtention.deps.json │ └── Release │ │ ├── UploadFileExtentions.2.0.0.nupkg │ │ ├── net5.0 │ │ ├── SecureFileUploadExtention.dll │ │ ├── SecureFileUploadExtention.pdb │ │ ├── ref │ │ │ └── SecureFileUploadExtention.dll │ │ └── SecureFileUploadExtention.deps.json │ │ └── net6.0 │ │ ├── SecureFileUploadExtention.dll │ │ ├── SecureFileUploadExtention.pdb │ │ └── SecureFileUploadExtention.deps.json ├── obj │ ├── Release │ │ ├── net5.0 │ │ │ ├── SecureFileUploadExtention.csproj.AssemblyReference.cache │ │ │ ├── SecureFileUploadExtention.AssemblyInfoInputs.cache │ │ │ ├── SecureFileUploadExtention.csproj.CoreCompileInputs.cache │ │ │ ├── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.pdb │ │ │ ├── ref │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.assets.cache │ │ │ ├── .NETCoreApp,Version=v5.0.AssemblyAttributes.cs │ │ │ ├── SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig │ │ │ ├── SecureFileUploadExtention.AssemblyInfo.cs │ │ │ └── SecureFileUploadExtention.csproj.FileListAbsolute.txt │ │ ├── net6.0 │ │ │ ├── SecureFileUploadExtention.AssemblyInfoInputs.cache │ │ │ ├── SecureFileUploadExtention.csproj.CoreCompileInputs.cache │ │ │ ├── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.pdb │ │ │ ├── ref │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── refint │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.assets.cache │ │ │ ├── SecureFileUploadExtention.csproj.AssemblyReference.cache │ │ │ ├── .NETCoreApp,Version=v6.0.AssemblyAttributes.cs │ │ │ ├── SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig │ │ │ ├── SecureFileUploadExtention.AssemblyInfo.cs │ │ │ └── SecureFileUploadExtention.csproj.FileListAbsolute.txt │ │ ├── UploadFileExtentions.2.0.0.nuspec │ │ └── UploadFileExtentions.1.0.0.nuspec │ ├── Debug │ │ ├── net5.0 │ │ │ ├── SecureFileUploadExtention.AssemblyInfoInputs.cache │ │ │ ├── SecureFileUploadExtention.csproj.CoreCompileInputs.cache │ │ │ ├── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.pdb │ │ │ ├── ref │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── refint │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.assets.cache │ │ │ ├── SecureFileUploadExtention.csproj.AssemblyReference.cache │ │ │ ├── .NETCoreApp,Version=v5.0.AssemblyAttributes.cs │ │ │ ├── SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig │ │ │ ├── SecureFileUploadExtention.AssemblyInfo.cs │ │ │ └── SecureFileUploadExtention.csproj.FileListAbsolute.txt │ │ ├── net6.0 │ │ │ ├── SecureFileUploadExtention.AssemblyInfoInputs.cache │ │ │ ├── SecureFileUploadExtention.csproj.CoreCompileInputs.cache │ │ │ ├── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.pdb │ │ │ ├── ref │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── refint │ │ │ │ └── SecureFileUploadExtention.dll │ │ │ ├── SecureFileUploadExtention.assets.cache │ │ │ ├── SecureFileUploadExtention.csproj.AssemblyReference.cache │ │ │ ├── .NETCoreApp,Version=v6.0.AssemblyAttributes.cs │ │ │ ├── SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig │ │ │ ├── SecureFileUploadExtention.AssemblyInfo.cs │ │ │ └── SecureFileUploadExtention.csproj.FileListAbsolute.txt │ │ └── UploadFileExtentions.1.0.0.nuspec │ ├── SecureFileUploadExtention.csproj.nuget.g.targets │ ├── project.nuget.cache │ ├── SecureFileUploadExtention.csproj.nuget.g.props │ ├── project.assets.json │ └── SecureFileUploadExtention.csproj.nuget.dgspec.json ├── ViewModels │ └── UploadFileResult.cs ├── SecureFileUploadExtention.csproj └── FileSecurity │ └── ValidateFiles.cs ├── SecureFileUploadExtention.sln └── README.md /.vs/SecureFileUploadExtention/FileContentIndex/read.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/UploadFileExtentions.1.0.0.nupkg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- 1 | MBRSC -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 1e95719a0419125a014a3ba7c44c4119ae2169a2 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | c166be38782a4cda08def3040850ded2005757b3 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 45251e73fd36d53847c5969276796e04cb8243a9 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | d945073835d98b1fb58058bed55937b6dddbb31b 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | cfb617b295ccc9fddee67983f7d50da09720d2ff 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 24b475fd5e35ed22a1117a27df0059a289598e1d 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 1ffcd3744822fa4c6bcad23d69ac607b999638bb 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 88ee1c4551530b49704cb7fd86f4ac9592029a39 2 | -------------------------------------------------------------------------------- /.vs/SecureFileUploadExtention/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/.vs/SecureFileUploadExtention/v16/.suo -------------------------------------------------------------------------------- /.vs/SecureFileUploadExtention/v17/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/.vs/SecureFileUploadExtention/v17/.suo -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/UploadFileExtentions.2.0.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Release/UploadFileExtentions.2.0.0.nupkg -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net5.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Debug/net5.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net5.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Debug/net5.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net6.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Debug/net6.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net6.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Debug/net6.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net5.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Release/net5.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net5.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Release/net5.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net6.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Release/net6.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net6.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Release/net6.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.pdb -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/SecureFileUploadExtention.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net5.0/ref/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Debug/net5.0/ref/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/ref/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net5.0/ref/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/ref/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net6.0/ref/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net5.0/ref/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/bin/Release/net5.0/ref/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/refint/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net5.0/refint/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/refint/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net6.0/refint/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/ref/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net5.0/ref/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/ref/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net6.0/ref/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.assets.cache -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.assets.cache -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/refint/SecureFileUploadExtention.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net6.0/refint/SecureFileUploadExtention.dll -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.assets.cache -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.assets.cache -------------------------------------------------------------------------------- /.vs/SecureFileUploadExtention/FileContentIndex/54659c04-a5eb-4de9-b0f3-8dde099c31a9.vsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/.vs/SecureFileUploadExtention/FileContentIndex/54659c04-a5eb-4de9-b0f3-8dde099c31a9.vsidx -------------------------------------------------------------------------------- /.vs/SecureFileUploadExtention/FileContentIndex/5c3c1000-1487-4cb0-ae85-30a5e13d0101.vsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/.vs/SecureFileUploadExtention/FileContentIndex/5c3c1000-1487-4cb0-ae85-30a5e13d0101.vsidx -------------------------------------------------------------------------------- /.vs/SecureFileUploadExtention/FileContentIndex/f452ea4c-1f49-4c96-a2ec-df2985f5b262.vsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/.vs/SecureFileUploadExtention/FileContentIndex/f452ea4c-1f49-4c96-a2ec-df2985f5b262.vsidx -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashnoori11/UploadFileExtention_Asp.NetCore/HEAD/SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "e7UIjgZ4iujmrXVeeBazdvye9VXnSJjx0l6+wwnMwMEgK2UhL7skpOrKXCpZNE2iJX3IyZlVvZD3Zg5sosLyMg==", 4 | "success": true, 5 | "projectFilePath": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj", 6 | "expectedPackageFiles": [], 7 | "logs": [] 8 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net5.0/SecureFileUploadExtention.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v5.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v5.0": { 9 | "SecureFileUploadExtention/1.0.0": { 10 | "runtime": { 11 | "SecureFileUploadExtention.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "SecureFileUploadExtention/1.0.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Debug/net6.0/SecureFileUploadExtention.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v6.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v6.0": { 9 | "SecureFileUploadExtention/1.0.0": { 10 | "runtime": { 11 | "SecureFileUploadExtention.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "SecureFileUploadExtention/1.0.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net5.0/SecureFileUploadExtention.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v5.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v5.0": { 9 | "SecureFileUploadExtention/1.0.0": { 10 | "runtime": { 11 | "SecureFileUploadExtention.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "SecureFileUploadExtention/1.0.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/bin/Release/net6.0/SecureFileUploadExtention.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v6.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v6.0": { 9 | "SecureFileUploadExtention/2.0.0": { 10 | "runtime": { 11 | "SecureFileUploadExtention.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "SecureFileUploadExtention/2.0.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net5.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property._SupportedPlatformList = Linux,macOS,Windows 9 | build_property.RootNamespace = SecureFileUploadExtention 10 | build_property.ProjectDir = C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\ 11 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net6.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property._SupportedPlatformList = Linux,macOS,Windows 9 | build_property.RootNamespace = SecureFileUploadExtention 10 | build_property.ProjectDir = c:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\ 11 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net6.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property._SupportedPlatformList = Linux,macOS,Windows 9 | build_property.RootNamespace = SecureFileUploadExtention 10 | build_property.ProjectDir = C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\ 11 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net5.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property._SupportedPlatformList = Linux,macOS,Windows 9 | build_property.RootNamespace = SecureFileUploadExtention 10 | build_property.ProjectDir = F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\ 11 | -------------------------------------------------------------------------------- /SecureFileUploadExtention.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31829.152 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecureFileUploadExtention", "SecureFileUploadExtention\SecureFileUploadExtention.csproj", "{0DC71060-B6A3-4A76-B11F-8C080D215D0B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0DC71060-B6A3-4A76-B11F-8C080D215D0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {0DC71060-B6A3-4A76-B11F-8C080D215D0B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {0DC71060-B6A3-4A76-B11F-8C080D215D0B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {0DC71060-B6A3-4A76-B11F-8C080D215D0B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {CC079515-26BE-4AAD-BC2A-B596F34531D2} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/ViewModels/UploadFileResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SecureFileUploadExtention.CustomResults 4 | { 5 | public record UploadFileResult 6 | { 7 | public UploadFileResult(bool _IsSuccess, List _Errors) 8 | { 9 | IsSuccess = _IsSuccess; 10 | Errors = _Errors; 11 | } 12 | 13 | public UploadFileResult(bool _IsSuccess, string error) 14 | { 15 | IsSuccess = _IsSuccess; 16 | this.Errors.Add(error); 17 | } 18 | 19 | public UploadFileResult(bool _IsSuccess, string _NewFileName, List _Errors) 20 | { 21 | IsSuccess = _IsSuccess; 22 | Errors = _Errors; 23 | NewFileName = _NewFileName; 24 | } 25 | 26 | public UploadFileResult(string _NewFileName) 27 | { 28 | IsSuccess =true; 29 | NewFileName = _NewFileName; 30 | } 31 | 32 | #region methods 33 | public void AddUploadFileErrors(List errors) 34 | => this.Errors = errors; 35 | #endregion 36 | 37 | public bool IsSuccess { get; private set; } 38 | public IList Errors { get; private set; } 39 | public string NewFileName { get; private set; } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/SecureFileUploadExtention.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\smart8\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages 9 | PackageReference 10 | 6.3.0 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("Ashkan Noori")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] 16 | [assembly: System.Reflection.AssemblyCopyrightAttribute("https://ashkannoori.onrender.com")] 17 | [assembly: System.Reflection.AssemblyDescriptionAttribute("Fast, easy and safe uploading of all types of files")] 18 | [assembly: System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] 19 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.0.0")] 20 | [assembly: System.Reflection.AssemblyProductAttribute("SecureFileUploadExtention")] 21 | [assembly: System.Reflection.AssemblyTitleAttribute("SecureFileUploadExtention")] 22 | [assembly: System.Reflection.AssemblyVersionAttribute("2.0.0.0")] 23 | [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore")] 24 | 25 | // Generated by the MSBuild WriteCodeFragment class. 26 | 27 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/SecureFileUploadExtention.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | uploadFileExtention.png 6 | 7 | UploadFileExtentions 8 | Ashkan Noori 9 | Fast, easy and safe uploading of all types of files 10 | true 11 | https://ashkannoori.onrender.com 12 | https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore 13 | https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore 14 | File,Upload,Secure,Extentions,Static,Async,Video,Image,pdf,DeleteFile,UploadFileExtention 15 | false 16 | 2.0.0 17 | UploadFiles 18 | 19 | Secure and easy implementation of Upload all file types for .net 6 20 | 21 | 22 | 23 | 24 | 25 | 26 | True 27 | \ 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/UploadFileExtentions.2.0.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UploadFileExtentions 5 | 2.0.0 6 | UploadFiles 7 | Ashkan Noori 8 | uploadFileExtention.png 9 | https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore 10 | Fast, easy and safe uploading of all types of files 11 | Secure and easy implementation of Upload all file types for .net 6 12 | https://ashkannoori.onrender.com 13 | File,Upload,Secure,Extentions,Static,Async,Video,Image,pdf,DeleteFile,UploadFileExtention 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/UploadFileExtentions.1.0.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UploadFileExtentions 5 | 1.0.0 6 | Ashkan Noori 7 | index.png 8 | https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore 9 | a open source package for uploading and validating all file types in C # and .Net Core projects. 10 | With this package, you will no longer need to write code to upload files and validate them. 11 | This package includes static methods and parallel programming is used in its coding. 12 | https://ashkannoori.onrender.com 13 | File,Upload,Secure,Extentions,Static,Async,Video,Image,pdf,DeleteFile,UploadFileExtention 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/UploadFileExtentions.1.0.0.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UploadFileExtentions 5 | 1.0.0 6 | Ashkan Noori 7 | index.png 8 | https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore 9 | a open source package for uploading and validating all file types in C # and .Net Core projects. 10 | With this package, you will no longer need to write code to upload files and validate them. 11 | This package includes static methods and parallel programming is used in its coding. 12 | https://ashkannoori.onrender.com 13 | File,Upload,Secure,Extentions,Static,Async,Video,Image,pdf,DeleteFile,UploadFileExtention 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyCompanyAttribute("Ashkan Noori")] 14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 15 | [assembly: System.Reflection.AssemblyCopyrightAttribute("https://AshkanNoodiDev.com")] 16 | [assembly: System.Reflection.AssemblyDescriptionAttribute(@"a open source package for uploading and validating all file types in C # and .Net Core projects. 17 | With this package, you will no longer need to write code to upload files and validate them. 18 | This package includes static methods and parallel programming is used in its coding.")] 19 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 20 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 21 | [assembly: System.Reflection.AssemblyProductAttribute("SecureFileUploadExtention")] 22 | [assembly: System.Reflection.AssemblyTitleAttribute("SecureFileUploadExtention")] 23 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 24 | [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore")] 25 | 26 | // Generated by the MSBuild WriteCodeFragment class. 27 | 28 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyCompanyAttribute("Ashkan Noori")] 14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 15 | [assembly: System.Reflection.AssemblyCopyrightAttribute("https://ashkannoori.onrender.com")] 16 | [assembly: System.Reflection.AssemblyDescriptionAttribute(@"a open source package for uploading and validating all file types in C # and .Net Core projects. 17 | With this package, you will no longer need to write code to upload files and validate them. 18 | This package includes static methods and parallel programming is used in its coding.")] 19 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 20 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 21 | [assembly: System.Reflection.AssemblyProductAttribute("SecureFileUploadExtention")] 22 | [assembly: System.Reflection.AssemblyTitleAttribute("SecureFileUploadExtention")] 23 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 24 | [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore")] 25 | 26 | // Generated by the MSBuild WriteCodeFragment class. 27 | 28 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("Ashkan Noori")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] 16 | [assembly: System.Reflection.AssemblyCopyrightAttribute("https://AshkanNoodiDev.com")] 17 | [assembly: System.Reflection.AssemblyDescriptionAttribute(@"a open source package for uploading and validating all file types in C # and .Net Core projects. 18 | With this package, you will no longer need to write code to upload files and validate them. 19 | This package includes static methods and parallel programming is used in its coding.")] 20 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 21 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 22 | [assembly: System.Reflection.AssemblyProductAttribute("SecureFileUploadExtention")] 23 | [assembly: System.Reflection.AssemblyTitleAttribute("SecureFileUploadExtention")] 24 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 25 | [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/ashnoori11/UploadFileExtention_Asp.NetCore")] 26 | 27 | // Generated by the MSBuild WriteCodeFragment class. 28 | 29 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net6.0/SecureFileUploadExtention.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Debug\net6.0\SecureFileUploadExtention.deps.json 2 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Debug\net6.0\SecureFileUploadExtention.dll 3 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Debug\net6.0\SecureFileUploadExtention.pdb 4 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.csproj.AssemblyReference.cache 5 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig 6 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.AssemblyInfoInputs.cache 7 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.AssemblyInfo.cs 8 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.csproj.CoreCompileInputs.cache 9 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.dll 10 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\refint\SecureFileUploadExtention.dll 11 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\SecureFileUploadExtention.pdb 12 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net6.0\ref\SecureFileUploadExtention.dll 13 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net6.0/SecureFileUploadExtention.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Release\net6.0\SecureFileUploadExtention.deps.json 2 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Release\net6.0\SecureFileUploadExtention.dll 3 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Release\net6.0\SecureFileUploadExtention.pdb 4 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.csproj.AssemblyReference.cache 5 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig 6 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.AssemblyInfoInputs.cache 7 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.AssemblyInfo.cs 8 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.csproj.CoreCompileInputs.cache 9 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.dll 10 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\refint\SecureFileUploadExtention.dll 11 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\SecureFileUploadExtention.pdb 12 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Release\net6.0\ref\SecureFileUploadExtention.dll 13 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Release/net5.0/SecureFileUploadExtention.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Release\net5.0\SecureFileUploadExtention.deps.json 2 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Release\net5.0\SecureFileUploadExtention.dll 3 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Release\net5.0\ref\SecureFileUploadExtention.dll 4 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Release\net5.0\SecureFileUploadExtention.pdb 5 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.csproj.AssemblyReference.cache 6 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig 7 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.AssemblyInfoInputs.cache 8 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.AssemblyInfo.cs 9 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.csproj.CoreCompileInputs.cache 10 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.dll 11 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\ref\SecureFileUploadExtention.dll 12 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Release\net5.0\SecureFileUploadExtention.pdb 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UploadFileExtention 2 | 3 | A Library to perform file-related operations on the .net core applications 4 | 5 | > Description 6 | 7 | ##### :100: By using this library and adding it to your project, you can skip writing codes for uploading file any types. 8 | ##### :robot: The library also performs rigorous validation when uploading files by check the file mime types. 9 | ##### :boom: By adding this package to your project, you can implement the parts related to working with files much faster. 10 | ##### :point_right: The methods and classes of this library are implemented in static and the codes are implemented executed in parallel. 11 | 12 | --------------------------------- 13 | 14 | # [How to Install](https://www.nuget.org/packages/UploadFileExtentions/2.0.0) 15 | 16 | #### PackageManager : [Install-Package UploadFileExtentions -Version 2.0.0](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-powershell) 17 | 18 | #### .Net CLI : [dotnet add package UploadFileExtentions --version 2.0.0](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli) 19 | 20 | -------------------------------- 21 | 22 | # Methods 23 | 24 | > Get Content Type 25 | 26 | - GetContentType(string path) returns file type as string 27 | 28 | 29 | > Validation :vampire: 30 | 31 | - IsValidFile(byte[] bytFile, FileType flType, string fileContentType) returns bool as result 32 | 33 | - IsValidImageFile(byte[] bytFile, string fileContentType) returns bool as result 34 | 35 | - IsValidVideoFile(byte[] bytFile, string fileContentType) returns bool as result 36 | 37 | - IsValidPdfFile(byte[] bytFile, string fileContentType) returns bool as result 38 | 39 | - IsValidDocDocxFile(byte[] bytFile, string fileContentType) returns bool as result 40 | 41 | - IsValidZipRarFile(byte[] bytFile, string fileContentType) returns bool as result 42 | 43 | 44 | > Upload and Delete Files 45 | 46 | - :octopus: UploadFileAsync(this IFormFile file, string path,FileType type,string fileName="", bool generateNewFileName = false) 47 | 48 | - :snail: UploadFileBase64(this string base64,string path) 49 | 50 | - :whale: void(string path) 51 | 52 | 53 | --------------------------- 54 | 55 | # How To Use 56 | 57 | > using SecureFileUploadExtention.FileSecurity; 58 | 59 | 60 | IFormFile file=attachment; 61 | var uploadFileResult = await file.UploadFileAsync(path,FileType.Video,file.Name,true); 62 | 63 | 64 | 65 | 66 | ----------------------------------------------------- 67 | 68 | ### :gift_heart: Dedicated with love to all programmers in the world _ [Ashkan Noori](https://ashkannooridev.com) :gift_heart: 69 | 70 | 71 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/project.assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "targets": { 4 | "net6.0": {} 5 | }, 6 | "libraries": {}, 7 | "projectFileDependencyGroups": { 8 | "net6.0": [] 9 | }, 10 | "packageFolders": { 11 | "C:\\Users\\smart8\\.nuget\\packages\\": {}, 12 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} 13 | }, 14 | "project": { 15 | "version": "2.0.0", 16 | "restore": { 17 | "projectUniqueName": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj", 18 | "projectName": "UploadFileExtentions", 19 | "projectPath": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj", 20 | "packagesPath": "C:\\Users\\smart8\\.nuget\\packages\\", 21 | "outputPath": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\obj\\", 22 | "projectStyle": "PackageReference", 23 | "fallbackFolders": [ 24 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" 25 | ], 26 | "configFilePaths": [ 27 | "C:\\Users\\smart8\\AppData\\Roaming\\NuGet\\NuGet.Config", 28 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", 29 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 30 | ], 31 | "originalTargetFrameworks": [ 32 | "net6.0" 33 | ], 34 | "sources": { 35 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 36 | "https://api.nuget.org/v3/index.json": {} 37 | }, 38 | "frameworks": { 39 | "net6.0": { 40 | "targetAlias": "net6.0", 41 | "projectReferences": {} 42 | } 43 | }, 44 | "warningProperties": { 45 | "warnAsError": [ 46 | "NU1605" 47 | ] 48 | } 49 | }, 50 | "frameworks": { 51 | "net6.0": { 52 | "targetAlias": "net6.0", 53 | "imports": [ 54 | "net461", 55 | "net462", 56 | "net47", 57 | "net471", 58 | "net472", 59 | "net48", 60 | "net481" 61 | ], 62 | "assetTargetFallback": true, 63 | "warn": true, 64 | "frameworkReferences": { 65 | "Microsoft.AspNetCore.App": { 66 | "privateAssets": "none" 67 | }, 68 | "Microsoft.NETCore.App": { 69 | "privateAssets": "all" 70 | } 71 | }, 72 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400\\RuntimeIdentifierGraph.json" 73 | } 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/SecureFileUploadExtention.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj": { 8 | "version": "2.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj", 11 | "projectName": "UploadFileExtentions", 12 | "projectPath": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\SecureFileUploadExtention.csproj", 13 | "packagesPath": "C:\\Users\\smart8\\.nuget\\packages\\", 14 | "outputPath": "C:\\MyNugets\\UploadFile\\UploadFileExtention_Asp.NetCore\\SecureFileUploadExtention\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\smart8\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", 22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 23 | ], 24 | "originalTargetFrameworks": [ 25 | "net6.0" 26 | ], 27 | "sources": { 28 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 29 | "https://api.nuget.org/v3/index.json": {} 30 | }, 31 | "frameworks": { 32 | "net6.0": { 33 | "targetAlias": "net6.0", 34 | "projectReferences": {} 35 | } 36 | }, 37 | "warningProperties": { 38 | "warnAsError": [ 39 | "NU1605" 40 | ] 41 | } 42 | }, 43 | "frameworks": { 44 | "net6.0": { 45 | "targetAlias": "net6.0", 46 | "imports": [ 47 | "net461", 48 | "net462", 49 | "net47", 50 | "net471", 51 | "net472", 52 | "net48", 53 | "net481" 54 | ], 55 | "assetTargetFallback": true, 56 | "warn": true, 57 | "frameworkReferences": { 58 | "Microsoft.AspNetCore.App": { 59 | "privateAssets": "none" 60 | }, 61 | "Microsoft.NETCore.App": { 62 | "privateAssets": "all" 63 | } 64 | }, 65 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400\\RuntimeIdentifierGraph.json" 66 | } 67 | } 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /SecureFileUploadExtention/obj/Debug/net5.0/SecureFileUploadExtention.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.csproj.AssemblyReference.cache 2 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig 3 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.AssemblyInfoInputs.cache 4 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.AssemblyInfo.cs 5 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.csproj.CoreCompileInputs.cache 6 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Debug\net5.0\SecureFileUploadExtention.deps.json 7 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Debug\net5.0\SecureFileUploadExtention.dll 8 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Debug\net5.0\ref\SecureFileUploadExtention.dll 9 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\bin\Debug\net5.0\SecureFileUploadExtention.pdb 10 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.dll 11 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\ref\SecureFileUploadExtention.dll 12 | F:\myNugetPackages\SecureFileUpload\SecureFileUploadExtention\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.pdb 13 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Debug\net5.0\SecureFileUploadExtention.deps.json 14 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Debug\net5.0\SecureFileUploadExtention.dll 15 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\bin\Debug\net5.0\SecureFileUploadExtention.pdb 16 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.csproj.AssemblyReference.cache 17 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.GeneratedMSBuildEditorConfig.editorconfig 18 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.AssemblyInfoInputs.cache 19 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.AssemblyInfo.cs 20 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.csproj.CoreCompileInputs.cache 21 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.dll 22 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\refint\SecureFileUploadExtention.dll 23 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\SecureFileUploadExtention.pdb 24 | C:\MyNugets\UploadFile\UploadFileExtention_Asp.NetCore\SecureFileUploadExtention\obj\Debug\net5.0\ref\SecureFileUploadExtention.dll 25 | -------------------------------------------------------------------------------- /SecureFileUploadExtention/FileSecurity/ValidateFiles.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using SecureFileUploadExtention.CustomResults; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Threading.Tasks; 7 | 8 | namespace SecureFileUploadExtention.FileSecurity 9 | { 10 | public static class ValidateFiles 11 | { 12 | public static string GetContentType(string path) 13 | { 14 | var types = GetMimeTypes(); 15 | var ext = Path.GetExtension(path).ToLowerInvariant(); 16 | return types[ext]; 17 | } 18 | 19 | private static Dictionary GetMimeTypes() 20 | { 21 | return new Dictionary 22 | { 23 | {".txt", "text/plain"}, 24 | {".pdf", "application/pdf"}, 25 | {".doc", "application/vnd.ms-word"}, 26 | {".docx", "application/vnd.ms-word"}, 27 | {".xls", "application/vnd.ms-excel"}, 28 | {".xlsx", "application/vnd.openxmlformatsofficedocument.spreadsheetml.sheet"}, 29 | {".png", "image/png"}, 30 | {".jpg", "image/jpeg"}, 31 | {".jpeg", "image/jpeg"}, 32 | {".gif", "image/gif"}, 33 | {".csv", "text/csv"}, 34 | {".zip","application/zip" }, 35 | {".rar","application/x-rar" } 36 | }; 37 | } 38 | 39 | private enum ImageFileExtension 40 | { 41 | none = 0, 42 | jpg = 1, 43 | jpeg = 2, 44 | bmp = 3, 45 | gif = 4, 46 | png = 5 47 | } 48 | 49 | private enum VideoFileExtension 50 | { 51 | none = 0, 52 | wmv = 1, 53 | mpg = 2, 54 | mpeg = 3, 55 | mp4 = 4, 56 | avi = 5, 57 | flv = 6 58 | } 59 | 60 | private enum PdfFileExtension 61 | { 62 | none = 0, 63 | PDF = 1 64 | } 65 | 66 | private enum DocDocxFileExtention 67 | { 68 | none = 0, 69 | DOC = 1, 70 | DOCX = 2 71 | } 72 | 73 | private enum ZipRarFileExtention 74 | { 75 | none = 0, 76 | ZIP = 1, 77 | RAR = 2 78 | } 79 | 80 | public enum FileType 81 | { 82 | Image = 1, 83 | Video = 2, 84 | PDF = 3, 85 | Text = 4, 86 | DOC = 5, 87 | DOCX = 6, 88 | PPT = 7, 89 | ZIP = 8, 90 | RAR = 9 91 | } 92 | 93 | public static bool IsValidFile(byte[] bytFile, FileType flType, string fileContentType) 94 | { 95 | bool isvalid = false; 96 | 97 | if (flType == FileType.Image) 98 | { 99 | isvalid = IsValidImageFile(bytFile, fileContentType); 100 | } 101 | else if (flType == FileType.Video) 102 | { 103 | isvalid = IsValidVideoFile(bytFile, fileContentType); 104 | } 105 | else if (flType == FileType.PDF) 106 | { 107 | isvalid = IsValidPdfFile(bytFile, fileContentType); 108 | } 109 | 110 | else if (flType == FileType.DOC || flType == FileType.DOCX) 111 | { 112 | isvalid = IsValidDocDocxFile(bytFile, fileContentType); 113 | } 114 | 115 | else if (flType == FileType.RAR || flType == FileType.ZIP) 116 | { 117 | isvalid = IsValidZipRarFile(bytFile, fileContentType); 118 | } 119 | 120 | return isvalid; 121 | } 122 | 123 | public static bool IsValidImageFile(byte[] bytFile, string fileContentType) 124 | { 125 | bool isvalid = false; 126 | 127 | byte[] chkBytejpg = { 255, 216, 255 }; 128 | byte[] chkBytebmp = { 66, 77 }; 129 | byte[] chkBytegif = { 71, 73, 70, 56 }; 130 | byte[] chkBytepng = { 137, 80, 78, 71 }; 131 | 132 | 133 | ImageFileExtension imgfileExtn = ImageFileExtension.none; 134 | 135 | if (fileContentType.Contains("jpg") | fileContentType.Contains("jpeg")) 136 | { 137 | imgfileExtn = ImageFileExtension.jpg; 138 | } 139 | else if (fileContentType.Contains("png")) 140 | { 141 | imgfileExtn = ImageFileExtension.png; 142 | } 143 | else if (fileContentType.Contains("bmp")) 144 | { 145 | imgfileExtn = ImageFileExtension.bmp; 146 | } 147 | else if (fileContentType.Contains("gif")) 148 | { 149 | imgfileExtn = ImageFileExtension.gif; 150 | } 151 | 152 | if (imgfileExtn == ImageFileExtension.jpg || imgfileExtn == ImageFileExtension.jpeg) 153 | { 154 | if (bytFile.Length >= 4) 155 | { 156 | int j = 0; 157 | for (int i = 0; i <= 2; i++) 158 | { 159 | if (bytFile[i] == chkBytejpg[i]) 160 | { 161 | j = j + 1; 162 | if (j == 3) 163 | { 164 | isvalid = true; 165 | } 166 | } 167 | } 168 | } 169 | } 170 | 171 | 172 | else if (imgfileExtn == ImageFileExtension.png) 173 | { 174 | if (bytFile.Length >= 4) 175 | { 176 | int j = 0; 177 | for (int i = 0; i <= 3; i++) 178 | { 179 | if (bytFile[i] == chkBytepng[i]) 180 | { 181 | j = j + 1; 182 | if (j == 4) 183 | { 184 | isvalid = true; 185 | } 186 | } 187 | } 188 | } 189 | } 190 | else if (imgfileExtn == ImageFileExtension.bmp) 191 | { 192 | if (bytFile.Length >= 4) 193 | { 194 | int j = 0; 195 | for (int i = 0; i <= 1; i++) 196 | { 197 | if (bytFile[i] == chkBytebmp[i]) 198 | { 199 | j = j + 1; 200 | if (j == 2) 201 | { 202 | isvalid = true; 203 | } 204 | } 205 | } 206 | } 207 | } 208 | else if (imgfileExtn == ImageFileExtension.gif) 209 | { 210 | if (bytFile.Length >= 4) 211 | { 212 | int j = 0; 213 | for (int i = 0; i <= 1; i++) 214 | { 215 | if (bytFile[i] == chkBytegif[i]) 216 | { 217 | j = j + 1; 218 | if (j == 2) 219 | { 220 | isvalid = true; 221 | } 222 | } 223 | } 224 | } 225 | } 226 | return isvalid; 227 | } 228 | 229 | private static bool IsValidVideoFile(byte[] bytFile, string fileContentType) 230 | { 231 | byte[] chkBytewmv = { 48, 38, 178, 117 }; 232 | byte[] chkByteavi = { 82, 73, 70, 70 }; 233 | byte[] chkByteflv = { 70, 76, 86, 1 }; 234 | byte[] chkBytempg = { 0, 0, 1, 186 }; 235 | byte[] chkBytemp4 = { 0, 0, 0 }; 236 | bool isvalid = false; 237 | 238 | VideoFileExtension vdofileExtn = VideoFileExtension.none; 239 | if (fileContentType.Contains("wmv")) 240 | { 241 | vdofileExtn = VideoFileExtension.wmv; 242 | } 243 | else if (fileContentType.Contains("mpg") || fileContentType.Contains("mpeg")) 244 | { 245 | vdofileExtn = VideoFileExtension.mpg; 246 | } 247 | else if (fileContentType.Contains("mp4")) 248 | { 249 | vdofileExtn = VideoFileExtension.mp4; 250 | } 251 | else if (fileContentType.Contains("avi")) 252 | { 253 | vdofileExtn = VideoFileExtension.avi; 254 | } 255 | else if (fileContentType.Contains("flv")) 256 | { 257 | vdofileExtn = VideoFileExtension.flv; 258 | } 259 | 260 | if (vdofileExtn == VideoFileExtension.wmv) 261 | { 262 | if (bytFile.Length >= 4) 263 | { 264 | int j = 0; 265 | for (int i = 0; i <= 3; i++) 266 | { 267 | if (bytFile[i] == chkBytewmv[i]) 268 | { 269 | j = j + 1; 270 | if (j == 3) 271 | { 272 | isvalid = true; 273 | } 274 | } 275 | } 276 | } 277 | } 278 | else if ((vdofileExtn == VideoFileExtension.mpg || vdofileExtn == VideoFileExtension.mpeg)) 279 | { 280 | if (bytFile.Length >= 4) 281 | { 282 | int j = 0; 283 | for (int i = 0; i <= 3; i++) 284 | { 285 | if (bytFile[i] == chkBytempg[i]) 286 | { 287 | j = j + 1; 288 | if (j == 3) 289 | { 290 | isvalid = true; 291 | } 292 | } 293 | } 294 | } 295 | } 296 | else if (vdofileExtn == VideoFileExtension.mp4) 297 | { 298 | if (bytFile.Length >= 4) 299 | { 300 | int j = 0; 301 | for (int i = 0; i <= 2; i++) 302 | { 303 | if (bytFile[i] == chkBytemp4[i]) 304 | { 305 | j = j + 1; 306 | if (j == 3) 307 | { 308 | isvalid = true; 309 | } 310 | } 311 | } 312 | } 313 | } 314 | else if (vdofileExtn == VideoFileExtension.avi) 315 | { 316 | if (bytFile.Length >= 4) 317 | { 318 | int j = 0; 319 | for (int i = 0; i <= 3; i++) 320 | { 321 | if (bytFile[i] == chkByteavi[i]) 322 | { 323 | j = j + 1; 324 | if (j == 3) 325 | { 326 | isvalid = true; 327 | } 328 | } 329 | } 330 | } 331 | } 332 | else if (vdofileExtn == VideoFileExtension.flv) 333 | { 334 | if (bytFile.Length >= 4) 335 | { 336 | int j = 0; 337 | for (int i = 0; i <= 3; i++) 338 | { 339 | if (bytFile[i] == chkByteflv[i]) 340 | { 341 | j = j + 1; 342 | if (j == 3) 343 | { 344 | isvalid = true; 345 | } 346 | } 347 | } 348 | } 349 | } 350 | 351 | return isvalid; 352 | 353 | } 354 | 355 | public static bool IsValidPdfFile(byte[] bytFile, string fileContentType) 356 | { 357 | byte[] chkBytepdf = { 37, 80, 68, 70 }; 358 | bool isvalid = false; 359 | 360 | PdfFileExtension pdffileExtn = PdfFileExtension.none; 361 | if (fileContentType.Contains("pdf")) 362 | { 363 | pdffileExtn = PdfFileExtension.PDF; 364 | } 365 | 366 | if (pdffileExtn == PdfFileExtension.PDF) 367 | { 368 | if (bytFile.Length >= 4) 369 | { 370 | int j = 0; 371 | for (int i = 0; i <= 3; i++) 372 | { 373 | if (bytFile[i] == chkBytepdf[i]) 374 | { 375 | j = j + 1; 376 | if (j == 4) 377 | { 378 | isvalid = true; 379 | } 380 | } 381 | } 382 | } 383 | } 384 | 385 | return isvalid; 386 | } 387 | 388 | public static bool IsValidDocDocxFile(byte[] bytFile, string fileContentType) 389 | { 390 | byte[] chkByteDoc = { 208, 207, 17, 224 }; 391 | byte[] chkByteDocx = { 80, 75, 3, 4 }; 392 | bool isvalid = false; 393 | 394 | DocDocxFileExtention docfileExtn = DocDocxFileExtention.none; 395 | if (fileContentType.Contains("doc")) 396 | { 397 | docfileExtn = DocDocxFileExtention.DOC; 398 | } 399 | 400 | else if (fileContentType.Contains("docx")) 401 | { 402 | docfileExtn = DocDocxFileExtention.DOCX; 403 | } 404 | 405 | if (docfileExtn == DocDocxFileExtention.DOC) 406 | { 407 | if (bytFile.Length >= 4) 408 | { 409 | int j = 0; 410 | for (int i = 0; i <= 3; i++) 411 | { 412 | if (bytFile[i] == chkByteDoc[i]) 413 | { 414 | j = j + 1; 415 | if (j == 4) 416 | { 417 | isvalid = true; 418 | } 419 | } 420 | } 421 | } 422 | } 423 | 424 | else if (docfileExtn == DocDocxFileExtention.DOCX) 425 | { 426 | if (bytFile.Length >= 4) 427 | { 428 | int j = 0; 429 | for (int i = 0; i <= 3; i++) 430 | { 431 | if (bytFile[i] == chkByteDocx[i]) 432 | { 433 | j = j + 1; 434 | if (j == 4) 435 | { 436 | isvalid = true; 437 | } 438 | } 439 | } 440 | } 441 | } 442 | 443 | return isvalid; 444 | } 445 | 446 | public static bool IsValidZipRarFile(byte[] bytFile, string fileContentType) 447 | { 448 | byte[] chkByteZip = { 80, 75, 3, 4 }; 449 | byte[] chkByteRar = { 82, 97, 114, 33 }; 450 | bool isvalid = false; 451 | 452 | ZipRarFileExtention ziprarfileExtn = ZipRarFileExtention.none; 453 | if (fileContentType.Contains("zip")) 454 | { 455 | ziprarfileExtn = ZipRarFileExtention.ZIP; 456 | } 457 | 458 | else if (fileContentType.Contains("rar")) 459 | { 460 | ziprarfileExtn = ZipRarFileExtention.RAR; 461 | } 462 | 463 | if (ziprarfileExtn == ZipRarFileExtention.ZIP) 464 | { 465 | if (bytFile.Length >= 4) 466 | { 467 | int j = 0; 468 | for (int i = 0; i <= 3; i++) 469 | { 470 | if (bytFile[i] == chkByteZip[i]) 471 | { 472 | j = j + 1; 473 | if (j == 4) 474 | { 475 | isvalid = true; 476 | } 477 | } 478 | } 479 | } 480 | } 481 | 482 | else if (ziprarfileExtn == ZipRarFileExtention.RAR) 483 | { 484 | if (bytFile.Length >= 4) 485 | { 486 | int j = 0; 487 | for (int i = 0; i <= 3; i++) 488 | { 489 | if (bytFile[i] == chkByteRar[i]) 490 | { 491 | j = j + 1; 492 | if (j == 4) 493 | { 494 | isvalid = true; 495 | } 496 | } 497 | } 498 | } 499 | } 500 | 501 | return isvalid; 502 | } 503 | 504 | /// 505 | /// upload and validating files 506 | /// 507 | /// 508 | /// 509 | /// 510 | /// 511 | /// 512 | /// UploadFileResult(bool IsSuccess, string NewFileName, List Errors) 513 | public static async Task UploadFileAsync(this IFormFile file, FileType type, string path, string fileName = "", bool generateNewFileName = false) 514 | { 515 | try 516 | { 517 | string FileExtension = Path.GetExtension(file.FileName); 518 | string newFileName = string.Empty; 519 | 520 | if (generateNewFileName) 521 | newFileName = $"{Guid.NewGuid()}{FileExtension}"; 522 | else 523 | newFileName = string.IsNullOrWhiteSpace(fileName) == true ? file.FileName : fileName; 524 | 525 | if (Directory.Exists(path) == false) 526 | Directory.CreateDirectory(path); 527 | 528 | string fullPath = string.IsNullOrWhiteSpace(newFileName) == false ? 529 | $"{path}/{newFileName}" : $"{path}/{file.FileName}"; 530 | 531 | bool result = default; 532 | using (var memory = new MemoryStream()) 533 | { 534 | await file.CopyToAsync(memory); 535 | result = IsValidFile(memory.ToArray(), type, FileExtension.Replace('.', ' ')); 536 | 537 | if (!result) 538 | { 539 | memory.Close(); 540 | return new UploadFileResult(false, "invalid file type !"); 541 | } 542 | } 543 | 544 | using (var stream = new FileStream(fullPath, FileMode.Create)) 545 | { 546 | await file.CopyToAsync(stream); 547 | } 548 | 549 | return new UploadFileResult(newFileName); 550 | } 551 | catch (Exception exp) 552 | { 553 | #if DEBUG 554 | return new UploadFileResult(false, new List() { exp.Message, exp.StackTrace }); 555 | #else 556 | return new UploadFileResult(false, "There was an error uploading the file"); 557 | #endif 558 | } 559 | } 560 | 561 | /// 562 | /// removes any kind of files with file path 563 | /// 564 | /// 565 | public static void DeleteFile(string path) 566 | { 567 | if (File.Exists(path)) 568 | File.Delete(path); 569 | } 570 | 571 | /// 572 | /// upload file with base64 string and path 573 | /// 574 | /// 575 | /// 576 | public static void UploadFileBase64(this string base64, string path) 577 | { 578 | byte[] bytes = Convert.FromBase64String(base64); 579 | File.WriteAllBytes(path, bytes); 580 | } 581 | } 582 | } 583 | --------------------------------------------------------------------------------