Hi Kapil,
Let us say that you FileUpload control has id as "FileUpload1".
You can use the following javascript for this:
function validateFileSize() {
var uploadControl = document.getElementById('<%= FileUpload1.ClientID %>');
if (uploadControl.files[0].size > 1048576*5) {
alert('Maximum size allowed is 5 MB');
return false;
}
else {
return true;
}
}
Also, add this to you FileUpload Control,
onchange="validateFileSize();"
Hope this works for you !! :)
Regards,
Praneet