Thursday 20 February 2014

Check Image size and type using javascript in asp.net

 function GetFileSizetypeIMG() {
    var maxsize=2*1024*1024//1mb=1*1024*1024
        var aspFileUpload = document.getElementById("<%=Upload1.ClientID%>");
        var filesze = aspFileUpload.files[0].size;
        var fileName = aspFileUpload.value;
        var ext = fileName.substr(fileName.lastIndexOf('.') + 1).toLowerCase();
        if (!(ext == "zip")) {
            alert("Invalid file type, must select a (*.zip) file");
            return false;
        }
        if (filesze > maxsize) {
            alert("Selected file not more than " + maxsize/(1024*1024)+"MB");
            return false;
        }
        return false;
    }

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...