?? htmlinputfile.aspx
字號(hào):
<html>
<font face="宋體" size="0">
<head>
<script language="VB" runat="server">
Sub Button1_click(sender As Object,e As EventArgs)
'判斷Text,Value的值是否為空
If Text1.Value=" " Then
Span1.InnerHtml="錯(cuò)誤:必須輸入文件名!"
Return
End if
If Not IsNothing(File1.PostedFile) Then
Try
File1.PostedFile.SaveAs("d:\asp.net\samples"+Text1.Value)
Span1.InnerHtml="文件成功傳送到d:\asp.net\samples" & Text1.Value & "</b>"
Catch exc As Exception
Span1.InnerHtml="文件傳送失敗"
End Try
End If
End Sub
</script>
<title>HtmlInputFile舉例</title>
</head>
<body>
<h3>
<font face="宋體" size="-1">HtmlInputFile 舉例</font>
</h3>
<form enctyte="multipart/form-data" runat="server">
<font face="宋體" size="-1">
<--!布置HtmlInputFile控件-->
選擇上傳文件:
</font>
<input id="File1"
type=file
runat="server"
>
<p>
<font face="宋體" size="-1">
存儲(chǔ)時(shí)的文件名:
</font>
<input id="Text1"
type="text"
runat="server"
>
<p>
<span id=Span1
style="font:12pt 宋體;"
runat="server"
/>
<p>
<input type=button
id="button1"
value="上傳"
OnServerClick="Button1_Click"
runat="server"
>
</script>
</form>
</body>
</font>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -