In one of my previous articles I have explained how to upload multiple files GMAIL style using jQuery Uploadify plugin
Here I will explain how we can use restrict the file size before upload using this plugin. jQuery Uploadify plugin has a sizeLimit attribute which accepts the size in bytes.
 
<script type = "text/javascript">
    $(window).load(
    function () {
        $("#<%=FileUpload1.ClientID %>").fileUpload({
            'uploader': 'scripts/uploader.swf',
            'cancelImg': 'images/cancel.png',
            'buttonText': 'Browse Files',
            'script': 'Upload.ashx',
            'folder': 'uploads',
            'fileDesc': 'Image Files',
            'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
            'multi': true,
            'auto': true,
            'sizeLimit': (600 * 1024), //600 KB
            onError: function (a, b, c, d) {
                if (d.type === "File Size") {
                    // Display error message in span
                    $("#err").html('File: ' + c.name + ' Maximum ' + d.type + ' Limit: ' + Math.round(d.sizeLimit / 1024) + 'KB');
                }
            }
        });
    }
);
</script>
 
As you can see above I have specified the size limit of 600 KB. If the file size exceeds the limit it throws File Size error as shown in the screenshot below.
Autocomplete with images jQuery plugin - Autocomplete list with images
Downloads
You can download the sample code in VB.Net and C# using the download link provided below.
File Size Validation using jQuery