Posted on: 7/5/2014 5:21:08 AM | Views : 382

I want to check file size before uploading it in client side. In chrome and mozilla it can be done easily using file.size . But in IE(9 and below i think) it does not support this method.
So i used activex method as shown in this link
function GetFileSize(fileid) { try { var fileSize = 0; //for IE if ($.browser.msie) { //before making an object of ActiveXObject, //please make sure ActiveX is enabled in your IE browser var objFSO = new ActiveXObject("Scripting.FileSystemObject"); var filePath = $("#" + fileid)[0].value; var objFile = objFSO.getFile(filePath); var fileSize = objFile.size; //size in kb fileSize = fileSize / 1048576; //size in mb } //for FF, Safari, Opeara and Others else { fileSize = $("#&qu ...

Go to the complete details ...