Click here to Skip to main content
15,941,620 members

Comments by kapil0411 (Top 17 by date)

kapil0411 25-Jun-15 4:33am View    
Thanks for you reply but i dont want to use any third party dll's.
kapil0411 5-Nov-14 4:26am View    
i tried with putting my java script in header content but its giving same error :(
kapil0411 5-Nov-14 2:22am View    
Below is my code.

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript" language="javascript">
function validateFileSize() {

var uploadControl = document.getElementById('<%= fileupld1.ClientID %>');
if (uploadControl.files[0].size > 1048576) {
alert('Maximum size allowed is 1 MB');
return false;
else {
return true;


<asp:FileUpload ID="fileupld1" runat="server" Onchange="return validateFileSize();" />

kapil0411 5-Nov-14 2:14am View    
Praneet i am getting error for
"uploadControl.files[0]" it is coming as null.
kapil0411 5-Nov-14 2:04am View    
Hi Praneet,
Thanks for your response.
but i am getting java script error in line :-
if (uploadControl.files[0].size > 1048576*5)

kindly help me on this