When we use Fileupload control in asp.net it has some limit of file size that you are willing to upload, if you want to validate that file size like you want that your upload size should be less than 50 kb.

you can easily get code for how to extend size of FileUpload Control

if (FileUpload1.HasFile)

int getlnthInByte = FileUpload1.PostedFile.ContentLength;
if (getlnthInByte <= 51200)  // File size in bytes

//now right your code for uploading image





hope you find out what you looking for.

Leave a Reply