当前位置:编程学习 > asp >>

如何简单地上传文件?

答案:

<html>

<script language="VB" runat="server">

Sub UploadBtn_Click(Sender as Object, E as EventArgs)

UploadFile.PostedFile.SaveAs(Server.MapPath("chunfeng.jpg"))

MyImage.ImageUrl = "chunfeng.jpg"

MyImage.Visible = true

End Sub

</script>

<head>

<title>星河影动之最简单的上传文件</title>

</head>

<body>

<form enctype="multipart/form-data" runat="server">

<h3>请选择上传的文件: <input id="UploadFile" type="file" runat="server"> <asp:button Text="上传文件" onClick="UploadBtn_Click" runat="server/"> </h3>

<hr>

<asp:image id="MyImage" Visible="false" runat="server/">

</form>

</body></html>

[1]

上一个:如何一行行地读取文件?
下一个:如何通过表单创建一个Word?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,