boguCms/App_Admin/news/addNewsColInfo.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using AccessDal;
using Model;
using System.IO;
public partial class App_Admin_news_addNewsColInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
bool fileOk = false;
if (FileUpload1.HasFile)
{
string fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
string[] allowedExtensions = { ".gif", ".png", ".jpg", ".jpeg" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOk = true;
}
}
if (fileOk == true && FileUpload1.PostedFile.ContentLength <= 1048576)
{
try
{
string d = DateTime.Now.ToString("yyyyMMddHHmmss");
string temppath = Server.MapPath("/userimg/imgs/") + d + fileExtension;
string mypath = Server.MapPath("/userimg/pro/") + d + fileExtension;
FileUpload1.SaveAs(temppath);
Photo.MakeThumbnail(temppath, mypath, 400, 300, "Cut");
File.Delete(temppath);
int flag1 = NewsColInfoOpe.AddNewsColInfo("/userimg/pro/" + d + fileExtension, txtTitle.Text, DateTime.Now.ToString());
if (flag1 != 0)
{
Page.RegisterStartupScript("script", "<script>alert('新闻类别添加成功!');window.location.href='NewsColInfo.aspx'</script>");
}
else
{
Page.RegisterStartupScript("script", "<script>alert('新闻类别添加失败!')</script>");
//File.Delete(mypath);
}
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
后面还有 23 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。