I need to verify that a file upload by a user does not exceed 10mb. Will this get the job done?
var fileSize = imageFile.ContentLength;
if ((fileSize * 131072) > 10)
{
// image is too large
}
I've been looking at this thread, and this one... but neither gets me all the way there. I'm using this as the conversion ratio.
.ContentLength
gets the size in bytes. Then I need to convert it to mb.