Web/Admin/AddPictures.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class Web_Admin_AddPictures : System.Web.UI.Page
{
Dbhelp dh = new Dbhelp();
string filename=string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserPower"] == null)
{
Response.Redirect("Admin.aspx");
return;
}
TxtFileName.Focus();
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
try
{
string str = FileUpload1.PostedFile.FileName;
filename = str.Substring(str.LastIndexOf("\\") + 1);
string type=filename.Substring(filename.LastIndexOf("."));
if (type != ".jpg"&type!=".JPG")
{
dh.MessageShowBox("请上传正确的文件格式!");
return;
}
string sql = "select count(*) from ShowImage where PhotoName='"+filename+"'";
if (dh.CheckLogin(sql) > 0)
{
dh.MessageShowBox("该图片已添加过,请核实!");
return;
}
//string filename = TxtFileName.Text.Trim();
string filepath = "../../" + "ShowImage//" + filename;
FileUpload1.PostedFile.SaveAs(Server.MapPath(filepath));
}
catch (Exception)
{
dh.MessageShowBox("上传失败!");
return;
}
// dh.MessageShowBox("上传成功!");
InsertPicture();
}
protected void InsertPicture()
{
string sql = string.Format("insert into ShowImage (FilePhotoPath,PhotoName) values('{0}','{1}')","~/ShowImage/"+filename.Trim(),filename);
if (dh.Exucte(sql) > 0)
dh.MessageShowBox("上传成功!");
后面还有 4 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
