mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +00:00
Bagels.
This commit is contained in:
parent
d5e460acf2
commit
be641700f8
2 changed files with 8 additions and 4 deletions
|
@ -43,12 +43,15 @@ namespace Project_Unite.Controllers
|
||||||
string[] allowedTypes = new[] { ".png", ".jpg", ".bmp", ".jpeg", ".gif" };
|
string[] allowedTypes = new[] { ".png", ".jpg", ".bmp", ".jpeg", ".gif" };
|
||||||
|
|
||||||
bool containsAllowedType = false;
|
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;
|
if (model.Image.FileName.EndsWith(ending))
|
||||||
break;
|
{
|
||||||
|
containsAllowedType = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (containsAllowedType == false)
|
if (containsAllowedType == false)
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Project_Unite.Models
|
||||||
public class UploadImageViewModel
|
public class UploadImageViewModel
|
||||||
{
|
{
|
||||||
[Required(ErrorMessage = "Please select an image to upload.")]
|
[Required(ErrorMessage = "Please select an image to upload.")]
|
||||||
|
[DataType(DataType.Upload)]
|
||||||
public HttpPostedFileBase Image { get; set; }
|
public HttpPostedFileBase Image { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue