Get File Size in a File Upload Control Before Uploading for Validation

In this post we will see how to make use of Jquery to get the file size before hand. We will make use of the change event to get the file size and reset the file upload controller.

Lets do the markup for our file upload controller as follows

Let see how can we get the file size using some Jquery

 

The above script will check for the filesize on change event and shows an alert if the file size exceeds 2MB.

This might not work well on older browsers, please do keep that in mind while using !

 

Over 6 years of experience in Software Development and Front End Development. Experience in Coding, Testing, Design on Microsoft Platform Technologies, HTML/CSS, scripting etc. Area of exposure includes software development using Microsoft Asp NET, C# and SQL Server for web.

Leave a Reply

Next ArticleAN INTRO TO ORACLE PRIVATE CLOUD APPLIANCE