I am using MVC WebImage helper
var image = WebImage.GetImageFromRequest();
It seems like the image is only allowed in image formats and there is a maximum size that is allowed set on the image.
for example, if I try to upload an "image" with extension .exe, it will be the same as
if (image == null)
which clearly isn't true, but WebImage helper seems to mark all non-image formats as null.
and if i try to upload an image that is too large, it will throw an error even though I didn't set any restrictions on the size of the image.
So my question
- What is the maximum allowed upload size? Is it something related to WebImage or is it related to something else(Browser, IIS etc)? if it is related to WebImage, how do I set it manually.
- What are the allowed formats? Where is the documentation? I've checked all over the place.
First: Maximum file size define on the WebServer level. So if you want to change it the best way for whole application is to change it in
Web.config
,maxRequestLength
. Ex:Second: The WebImage helper will attempt to return an image from any file that has an image MIME type.
So if you talking about extensions.
Following file types are accepted: ".jpg", ".png", ".bmp", & ".gif"
Following file types are not supported: ".ico", any non-image related file extension.