<system.web>
<httpRuntime executionTimeout="9999" maxRequestLength="2097151"/>
</system.web>
|
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
|
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
if (FileUpload1.PostedFile.ContentLength < 20728650)
{
try
{
Label1.Text = "File name: " +
FileUpload1.PostedFile.FileName + "<br>" +
FileUpload1.PostedFile.ContentLength + " kb<br>" +
"Content type: " +
FileUpload1.PostedFile.ContentType;
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
}
else
{
Label1.Text = "File size exceeds maximum limit 20 MB.";
}
}
}
|
<system.web>
<httpRuntime executionTimeout="9999" maxRequestLength="2097151"/>
</system.web>
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
5 comments :
can u pls tell me about sharing sql database over LAN...
how we can upload large file like 100-200 mb.
tnx
jasraj
how can i upload an image with some text data
test
Hi Suresh,
I had used ajax fileupload control to upload excel file in which i don't know the path but i want to read data in the file and i don't now the sheet name and file name
Please reply for the post