mobile/ajax/Upload_ajax.ashx
(完整代码) 1KB<%@ WebHandler Language="C#" Class="Upload_ajax" %>
using System;
using System.Web;
using Marriage_BLL;
using Marriage_Model;
using System.IO;
using System.Collections.Generic;
public class Upload_ajax : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string name = context.Request["name"];
var data = context.Request.Files["data"];
String id = context.Request["id"];
String zhaopian = context.Request["zhaopian"];
if(String.IsNullOrEmpty(zhaopian))
{
zhaopian = DateTime.Now.Year.ToString() + "_" + DateTime.Now.Month.ToString();
N25175_VIP_BLL bll = new N25175_VIP_BLL();
N25175_VIP_Model model = new N25175_VIP_Model();
model = bll.GetModel(new Guid(id));
model.v_zhaopian = zhaopian;
List<Guid> lst = new List<Guid>();
bll.Update(model,lst);
}
string dir = context.Server.MapPath("~/marriage/control/ps/"+zhaopian);
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
string file = System.IO.Path.Combine(dir, id+".jpg");
try
{
data.SaveAs(file);
}
catch(Exception)
{
context.Response.ContentType = "text/plain";
context.Response.Write("上传失败");
context.Response.End();
}
context.Response.ContentType = "text/plain";
context.Response.Write("上传成功,请刷新");
}
public bool IsReusable {
get {
return false;
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。