Check size of an Attached file thru FileUpload control

hi All

I have to Check size of an Attached file thru FileUpload control. My database size left 2MB & im attaching a file more than 2MB. So that how can i check the file size & flash a message.

when im browsing a file for attachment it is not attaching but it captures the name of the file in "AttList" field.

here is my code:


var Apath = document.forms[0].file.value;

if (Apath==“”)

{

alert("Please Select A File To Upload");

}

else

{

document.forms[0].fld_attached.value = Apath.substring(Apath.lastIndexOf("\\")+1,Apath.length);



if(document.forms[0].AttList.value.indexOf(document.forms[0].fld_attached.value) == -1)

{

	document.forms[0].AttList.value= document.forms[0].AttList.value + document.forms[0].fld_attached.value +" ; "

	document.forms[0].doneAlert.value=1;

	document.forms[0].submit();

}

else

{

	alert("You Have Already Attached This File !!");

}

}


Regards

Sanjay