I am trying to upload an image using asp.net razor / webmatrix. The upload works but I want to check the file extension of the image. At the moment I have the following code:
WebImage photo = null;
var newFileName = "";
var imagePath = "";
photo = WebImage.GetImageFromRequest();
@*if (photo != null)*@
if ((photo != null) && (photo.ImageFormat == "JPG"))
After uploading, an email is sent. The problem is the last line of code: photo.ImageFormat seems to be blocking all files regardless of type. When I remove that the code works to upload etc.
Any help greatly appreciated.