<%@ Page Language="C#" %> <script runat="server"> void UploadButton_Click(Object sender, EventArgs e) { if(FileInput.PostedFile != null) { try { FileInput.PostedFile.SaveAs("c:\\test.txt"); } catch (Exception exc) { Response.Write(exc.Message); } } } </script> <html> <head> </head> <body> <form id="Form1" method="post" enctype="multipart/form-data" runat="server"> <input id="FileInput" type="file" runat="server" /> <asp:Button id="UploadButton" onclick="UploadButton_Click" runat="server" Text="Upload"></asp:Button> </form> </body> </html>