ASP.Net/HTML Control/Input File Control

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

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

   <source lang="csharp">

<%@ 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:
<input

   id="MyFile" 
   type="file" 
   runat="server"

>

Enter the name only to save the file as:
<input

   id="txtFileSaveAs" 
   type="text" 
   runat="server"

>



<input

   runat="server"
   type=button 
   value="Upload" 
   OnServerClick="SubmitButton_Click" 

> </Font> </Form> </BODY> </HTML>

      </source>