You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are working on a web project like MVC or WebApi this library will provide you with all validation attributes you needed for easy data validation. You can install this library using NuGet into your project.
4
+
5
+
```nuget
6
+
Install-Package File.TypeChecker.Web
7
+
```
8
+
9
+
or by using dotnet CLI
10
+
11
+
```
12
+
dotnet add package File.TypeChecker.Web
13
+
```
14
+
15
+
## How to use?
16
+
17
+
This library will provide you with five powerful and easy to use validation attributes. They will give you the power to allow or forbid any supported type of file. For example you can restrict your users to be able to upload only images or only archives just by setting an attribute into your method or class.
18
+
19
+
All validation attributes should be used over IFormFile interface and can be used in a class over property or with method parameter.
20
+
21
+
- AllowImageOnly: This validation attribute will restrict IFormFile to be only image format like jpg, gif, bmp, png and tiff
22
+
- AllowArchiveOnly: This validation attribute will restrict IFormFIle to be only archive format.
23
+
- AllowedTypes: This validation attribute will allow you to specify what types of file you want to recive from user. We advice you to use FileExtension class to specify the extension string.
24
+
- ForbidExecutableFile: This validation attribute will forbid your users to upload executable files.
25
+
- ForbidTypes: This validation attribute will allow you to specify what types of file you don't want to recive from user. We advice you to use FileExtension class to specify the extension string.
Copy file name to clipboardExpand all lines: README.md
+54-8Lines changed: 54 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,13 @@
1
1
<h1><imgsrc="https://raw.githubusercontent.com/AJMitev/FileTypeChecker/master/tools/FileTypeCheckerLogo-150.png"align="left"alt="FileTypeChecker"width="90">FileTypeChecker - Don't let users to inject you an invalid file</h1>
FileTypeChecker is a easy to use library that allows you to identify type of file. This will help you to validate all files that are provided by external sources.
5
+
FileTypeChecker is a easy to use library that provides quality identification of a file type. This will help you to secure your applications and validate all files that are provided by external sources with few lines of code.
If you are working on a web project like MVC or WebApi use [File.TypeChecker.Web](https://www.nuget.org/packages/File.TypeChecker.Web/). This web library will provide you with all validation attributes you needed for easy data validation. Again You can install it by using NuGet
35
+
36
+
You can install this library using NuGet into your project.
37
+
38
+
```nuget
39
+
Install-Package File.TypeChecker.Web
40
+
```
41
+
42
+
or by using dotnet CLI
43
+
44
+
```
45
+
dotnet add package File.TypeChecker.Web
46
+
```
47
+
36
48
## How to use?
37
49
38
50
```c#
@@ -53,6 +65,40 @@ using (var fileStream = File.OpenRead("myFileLocation"))
53
65
}
54
66
```
55
67
68
+
### Web Application
69
+
70
+
With web package you will recive access to our validation attributes that will gives you easy and powerfull way to allow or forbid file types. For example you can restrict your users to be able to upload only images or only archives just by setting an attribute into your method or class.
0 commit comments