upimg.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Common;
public partial class a_upimg : System.Web.UI.Page
{
private const int MAXPHOTOSIZE = 4096000;//允许最大size
private const string PHOTOEXTENSION = ".jpg|.gif|.png|.bmp";//允许的格式
private string _picNameMemory;//保存图片名称的隐藏域名称
protected void Page_Load(object sender, EventArgs e)
{
InitMember();
Button1.Attributes.Add("onclick", "return checkInput()");
}
private void InitMember()
{
_picNameMemory = string.Empty;
if (!string.IsNullOrEmpty(Request.QueryString["nm"]))
_picNameMemory = Request.QueryString["nm"];
}
public static string GetTimeStr()
{
Random timeSeed = new Random(10);
DateTime CurrentTime = DateTime.Now;
return CurrentTime.ToString(@"yyyyMMddhhmmssffff");
}
public static string GetYearAndMonth()
{
Random timeSeed = new Random(10);
DateTime CurrentTime = DateTime.Now;
return CurrentTime.Year.ToString() + CurrentTime.Month.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
string FileName = Path.GetFileNameWithoutExtension(Uper.PostedFile.FileName);
string ExtensionName = Path.GetExtension(Uper.PostedFile.FileName);
string virtualPath = MapPath("../upimgs/");
if (PHOTOEXTENSION.IndexOf(ExtensionName.ToLower()) < 0)
{
Response.Write("<script type='text/javascript'>alert('文件格式不正确');</script>");
}
else if (Uper.PostedFile.ContentLength == 0)
{
Response.Write("<script type='text/javascript'>alert('请选择正确的上传路径');</script>");
}
else if (Uper.PostedFile.ContentLength > MAXPHOTOSIZE)
{
Response.Write("<script type='text/javascript'>alert('文件太大无法上传');</script>");
}
else
{
try
{
后面还有 28 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。