try this template
<pre lang="xml"><%@ Page Language="C#" %>
<script runat="server">
void SubmitButton_Click(Object sender, EventArgs e) {
if (File1.PostedFile != null) {
try {
File1.PostedFile.SaveAs("C:\\Uploads\\uploadedfile.txt");
Span1.InnerHtml = "Upload Successful!";
}
catch (Exception ex) {
Span1.InnerHtml = "Error saving file <b>C:\\" +
File1.Value + "</b><br>" + ex.ToString();
}
}
}
</script>
<html>
<head>
</head>
<body>
<form runat="server" enctype="multipart/form-data">
Select a file to upload:<br />
<input type="file" id="File1" runat="Server">
<p>
<input type="submit" id="Submit1" runat="Server"
value="Upload File" OnServerClick="SubmitButton_Click">
<p>
<span id="Span1" runat="Server" />
</form>
</body>
</html>