<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> <form id="form1" runat="server"> <div> <input type="file" id="file1" runat="server" /> <asp:Button ID="btnUpLoad" runat="server" Text="上传" OnClick="btnUpLoad_Click" /> <asp:Label ID="Label1" runat="server" Text="" Style="color: Red"></asp:Label> </div> </form> </body> </html>
protected void btnUpLoad_Click(object sender, EventArgs e)
{
//string serverpath = Server.MapPath("~/ImageFile");
if (file1.PostedFile.ContentLength > 0)
{
if (File.Exists(@"C:\Users\WJM\Desktop\FilesUpLoad\" + file1.PostedFile.FileName))
{
Label1.Text = "文件已经存在";
}
else
{
file1.PostedFile.SaveAs(@"C:\Users\WJM\Desktop\FilesUpLoad\" + file1.PostedFile.FileName);
Label1.Text = "上传成功!";
}
}
else
{
Label1.Text = "上传失败";
}
}
<?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <system.web> <httpRuntime executionTimeout="36000" delayNotificationTimeout="36000" maxRequestLength="2147483647" targetFramework="4.5"></httpRuntime> <compilation debug="true" targetFramework="4.5" /> <!--<httpRuntime targetFramework="4.5" />--> </system.web> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="2147483648"/> </requestFiltering> </security> </system.webServer> </configuration>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有