Tutorials Forums
     Tutorials Videos
        Sign Up Now For FREE
Welcome, Guest
Username Password: Remember me

File Upload
(1 viewing) (1) Guest
ASP.NET PROGRAMS, ASP.NET DESIGN, ASP.NET CODE, ASP.NET TOOLS

ASP.NET combines Active Server Pages with the .NET Framework. This technology allows you to create dynamic web applications. ASP.NET pages work in all browsers. Best of all, ASP.NET lets you build web pages using less code than you need with classic ASP. If you’re using ASP.NET to build some applications for your website, you owe it to yourself to check out the articles in this section.
  • Page:
  • 1

TOPIC: File Upload

File Upload 31 Dec 2009 18:18 #197



How to build the sample project:

Create a new Visual C# Web Application project. Default page is created by default.

 
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 79px;
}
.style3
{
width: 185px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
 
<table class="style1">
<tr>
<td class="style2">
Upload File</td>
<td class="style3">
<asp:FileUpload ID="FileUpload" runat="server" />
</td>
<td>
<asp:Button ID="btnUpload" runat="server" onclick="btnUpload_Click"
Text="Button" />
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="txtMessage" runat="server"></asp:Label>
</td>
</tr>
</table>
 
</div>
</form>
</body>
 


 
if (FileUpload.HasFile)
{
FileUpload.SaveAs("c:\\" + FileUpload.FileName);
txtMessage.Text = "File has been uploaded<br />";
txtMessage.Text += "File Name: " + FileUpload.FileName + "<br />";
txtMessage.Text += "File Size: " + FileUpload.FileContent.Length.ToString();
}
 


APPLIES TO

Microsoft Visual C# .NET 2002 Standard Edition
Microsoft Visual C# 2005 Express Edition
Microsoft Visual C# 2008 Express Edition

Download sample below :

This attachment is hidden for guests. Please log in or register to see it.
Attachments:
  • Attachment This attachment is hidden for guests. Please log in or register to see it.
  • CE
  • OFFLINE
  • Administrator
  • Posts: 197
  • Karma: 78
CodersEngine
  • Page:
  • 1
Time to create page: 0.37 seconds