I have an application which crops a picture and returns the result to the ViewModel as a base64 string. I need to check whether the size is within 1 MB or exceeds it.
This is my solution:
byte[] byteArray = Convert.FromBase64String(input);
if (byteArray.Length > Constants.PictureMaximumSize)
{
return false;
}
return true;
Where: Constants.PictureMaximumSize = 1048576;
My Question:
I want to check if it is up to 1 MB - should I compare the byte [] length to 1048576 or maybe to 1000000?