YKT_EShop/Admin/Picture/Upload.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using YKT_Common;
namespace YKT_EShop.Admin.Picture
{
public partial class Upload : System.Web.UI.Page
{
string newPath = "news";
protected FileUpload FileUpload1;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (this.FileUpload1.FileName == "")
{
Js.Alert("请选择一个图片!");
return;
}
string fileName = Path.GetFileName(this.FileUpload1.FileName);
string extension = Path.GetExtension(this.FileUpload1.FileName);
string filePath = DateTime.Now.ToString("yyyyMMdd");
string path1 = Server.MapPath("~/UpLoadFiles/" + newPath + "/" + filePath + "/");
if (!Directory.Exists(path1))
{
Directory.CreateDirectory(path1);
}
string fileName1 = DateRndName();
path1 = path1 + fileName1 + extension;
string path2 = "/UpLoadFiles/" + newPath + "/" + filePath + "/" + fileName1 + extension;
try
{
this.FileUpload1.SaveAs(path1);
this.ClientScript.RegisterStartupScript(this.GetType(), "upload", "<script>returnValue('" + path2 + "');</script>");
}
catch
{
throw new Exception();
}
}
/// <summary>
/// 日期
/// </summary>
/// <returns></returns>
private string DateRndName()
{
DateTime d = DateTime.Now;
string s = null, y, m, dd, h, mm, ss;
y = d.Year.ToString();
m = d.Month.ToString();
if (m.Length < 2) m = "0" + m;
后面还有 13 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。