//HTML
<asp:FileUpload ID="upl1" runat="server" onchange="CheckFileSize(this.id);" />
//SCRIPT
<script type="text/ecmascript">
function CheckFileSize(upid) {
var maxsize = 5 * 1024//1kb=1*1024
var aspFileUpload = document.getElementById("" + upid + "");
var filesze = aspFileUpload.files[0].size;
if (filesze > maxsize) {
alert("Maximum file size is " + maxsize / (1024) + "KB");
return false;
}
}
</script>
No comments:
Post a Comment