代码修改后的版本,全部提交
This commit is contained in:
62
Mtxfw.shop/artDialog/net/scrawlUp.cs
Normal file
62
Mtxfw.shop/artDialog/net/scrawlUp.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Web.SessionState;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
public class scrawlImgUp : IHttpHandler, IRequiresSessionState
|
||||
{
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
if (context.Session["MemberIdMemberId"] != null || (context.Session["MemberId"] != null && context.Session["MemberName"] != null))
|
||||
{
|
||||
context.Response.ContentType = "text/html";
|
||||
string action = context.Request["action"];
|
||||
|
||||
if (action == "tmpImg")
|
||||
{
|
||||
//上传配置
|
||||
string pathbase = "Files/Image/tmp/"; //保存路径
|
||||
int size = 2; //文件大小限制,单位mb //文件大小限制,单位KB
|
||||
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
|
||||
|
||||
//上传图片
|
||||
Hashtable info = new Hashtable();
|
||||
Uploader up = new Uploader();
|
||||
info = up.upFile(context, pathbase, filetype, size, (context.Session["MemberIdMemberId"] != null ? 1 : 0)); //获取上传状态
|
||||
|
||||
HttpContext.Current.Response.Write("<script>parent.ue_callback('" + info["url"] + "','" + info["state"] + "')</script>");//回调函数
|
||||
}
|
||||
else
|
||||
{
|
||||
string pathbase = "/Files/Image/"; //保存路径
|
||||
string tmpPath = "/Files/Image/tmp/"; //临时图片目录
|
||||
|
||||
//上传图片
|
||||
Hashtable info = new Hashtable();
|
||||
Uploader up = new Uploader();
|
||||
info = up.upScrawl(context, pathbase, tmpPath, context.Request["content"]); //获取上传状态
|
||||
|
||||
//向浏览器返回json数据
|
||||
HttpContext.Current.Response.Write("{'url':'" + info["url"] + "',state:'" + info["state"] + "'}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user