Web/Admin/Downloads/Add.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Net;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
namespace Web.Admin.Downloads
{
public partial class Add : Web.UI.ManagePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
chkLoginLevel("addDownloads");
//绑定类别
ChannelTreeBind(0, "请选择所属类别...", (int)Channel.Downloads, this.ddlClassId);
if (!string.IsNullOrEmpty(Request.Params["classId"]))
{
ddlClassId.SelectedValue = Request.Params["classId"].Trim();
}
}
}
//保存
protected void btnSave_Click(object sender, EventArgs e)
{
string filePath = txtFilePath.Text.Trim();
if (string.IsNullOrEmpty(filePath))
{
JscriptMsg(350, 230, "错误提示", "<b>请先上传文件!</b>上传文件不存在,请先上传文件再进行提交吧!", "", "Error");
return;
}
BLL.Downloads bll = new BLL.Downloads();
Model.Downloads model = new Model.Downloads();
//检查文件本地还是远程
if (filePath.ToLower().StartsWith("http://"))
{
try
{
HttpWebRequest _request = (HttpWebRequest)WebRequest.Create(filePath);
HttpWebResponse _response = (HttpWebResponse)_request.GetResponse();
model.FileSize = ((int)_response.ContentLength) / 1024;
model.FileType = filePath.Substring(filePath.LastIndexOf(".") + 1).ToUpper();
}
catch
{
JscriptMsg(350, 230, "错误提示", "<b>远程文件不存在!</b>远程文件不存在,请先检查后再进行提交吧!", "", "Error");
return;
}
}
else
{
string fullFilePath = Server.MapPath(filePath);
if (!File.Exists(fullFilePath))
{
后面还有 37 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。