diff options
Diffstat (limited to 'Project-Unite/Controllers')
| -rw-r--r-- | Project-Unite/Controllers/ManageController.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Project-Unite/Controllers/ManageController.cs b/Project-Unite/Controllers/ManageController.cs index 5f68eea..99f41c9 100644 --- a/Project-Unite/Controllers/ManageController.cs +++ b/Project-Unite/Controllers/ManageController.cs @@ -43,12 +43,15 @@ namespace Project_Unite.Controllers string[] allowedTypes = new[] { ".png", ".jpg", ".bmp", ".jpeg", ".gif" }; bool containsAllowedType = false; - foreach(var ending in allowedTypes) + if (model.Image != null) { - if (model.Image.FileName.EndsWith(ending)) + foreach (var ending in allowedTypes) { - containsAllowedType = true; - break; + if (model.Image.FileName.EndsWith(ending)) + { + containsAllowedType = true; + break; + } } } if (containsAllowedType == false) |
