日期:2014-05-17 浏览次数:20457 次
HttpContext.Current.Session["userName"].ToString();
<%@ WebHandler Language="C#" Class="imageUp" %>
using System;
using System.Web;
using System.IO;
using System.Collections;
using System.Web.SessionState;
public class imageUp : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//上传配置
int size = 2; //文件大小限制,单位MB //文件大小限制,单位MB
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
string username = context.Session["userName"].ToString();
if (!HasRight(username))
{
//提示没有权限
}
//上传图片
Hashtable info = new Hashtable();
Uploader up = new Uploader();
string pathbase = null;
int path = Convert.ToInt32(up.getOtherInfo(context, "dir"));
if (path == 1)
{
pathbase = "upload/";
}
else
{
&