页面代码主要就是JS
view plaincopy to clipboardprint
复制代码 代码如下:
<head runat="server">
<title>无标题页</title>
<mce:script language="javascript" type="text/javascript"><></mce:script>
</head>
<body>
<form id="form1" runat="server">
<div>
<img alt="" id="image" />
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Imagesrc()" />
<br />
<asp:Button ID="btnPost" runat="server"
Text="上传" /></div>
</form>
</body>
<head runat="server">
<title>无标题页</title>
<mce:script language="javascript" type="text/javascript"><></mce:script>
</head>
<body>
<form id="form1" runat="server">
<div>
<img alt="" id="image" />
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Imagesrc()" />
<br />
<asp:Button ID="btnPost" runat="server"
Text="上传" /></div>
</form>
</body>
defualt.aspx.cs代码
view plaincopy to clipboardprint
复制代码 代码如下:
protected void btnPost_Click(object sender, EventArgs e)
{
string PostName = Server.MapPath("Image");
string fileName = FileUpload1.FileName;
//是否包含此文件
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(PostName "/" fileName);
}
}
【asp.net实现上传文件显示本地绝对路径的实例代码】相关文章:
★ asp.net下用js实现鼠标移至小图,自动显示相应大图
★ asp.net Web Services上传和下载文件(完整代码)第1/2页
★ asp.net下配置数据源时出现: 未将对象引用设置到对象的实例。