aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Check File Size before Upload or Get Image Size before Upload jQuery

Jan 21, 2014

Here I will explain how to check file size before upload in jQuery  or jQuery get image size before upload using jQuery uploadify plugin in

In previous articles I explained
integrate Facebook login authentication, integrate twitter login authentication, jQuery randomly change color of div, jQuery upload multiple files using uploadify plugin in, jQuery upload multiple files using multiple file upload plugin in and many articles relating to jQuery,, c#, Now I will explain how to get file or image size before upload in jQuery using jQuery uploadify plugin in

By using jQuery uploadify plugin we can check image size before upload easily just setting sizelimit property like as shown below

$("#<%=upload1.ClientID %>").fileUpload({
'uploader': 'scripts/uploader.swf',
'cancelImg': 'cancel.png',
'buttonText': 'Select Files',
'script': 'Handler.ashx',
'folder': 'images',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': true,
'auto': true,
'sizeLimit': (200 * 1024), //200 KB
onError: function (a, b, c, d) {
if (d.type === "File Size") {
$("#lblmsg").html('File Size Should not exceed 200 KB');
onComplete: function () {
If you observe above code I set property 'sizeLimit' property to restrict upload image size to 200 KB


If you want complete code download it from attached sample
Download sample code attached 

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.