Jquery -Validating Upload file size
<p>Below code checks whether,file upload is empty and certain extension.I also need to check the file size.</p>

<p>For eg:if ,file size is more than 1 mb,i should show this to user.</p>

<pre><code>$('form').submit(function(event) {
   var file = $('input[type=file]').val();       

   if ( ! file) {
       alert('The file is required.');
       event.preventDefault();
       return;
   } 

   if (file.match(/\.(?:csv|xl)$/)) {
       alert('CSV or Excel files only!');
       event.preventDefault();
   }

});
</code></pre>

<p>Thanks in advance!!</p>
