Mega Code Archive

 
Categories / ASP.Net / Components
 

Uploading Files with the HTML Input File Control (VB net)

<%@ Page Language=VB Debug=true %> <script runat=server> Sub SubmitButton_Click(Source As Object, e As EventArgs) '   Not working  '   Change the following folder as your settings '    MyFile.PostedFile.SaveAs("./" & txtFileSaveAs.Value)     TheMessage.InnerHTML = "File uploaded!" End Sub </SCRIPT> <HTML> <HEAD> <TITLE>Uploading Files with the HTMLInputFile Control</TITLE> </HEAD> <BODY> <form      enctype="multipart/form-data"      runat="server"> Enter the name and path of the file to upload: <BR> <input      id="MyFile"      type="file"      runat="server" > <BR><BR> Enter the name only to save the file as: <BR> <input      id="txtFileSaveAs"      type="text"      runat="server" > <BR><BR> <span      id="TheMessage"     runat="server" > </span> <BR><BR> <input      runat="server"     type=button      value="Upload"      OnServerClick="SubmitButton_Click"  > </Font> </Form> </BODY> </HTML>