作者: extnet 时间: 2012-11-3 01:40
已经解决
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using Ext.Net;
namespace erp_asp_net.WebPage.Sales
{
public class result
{
public bool success;
public string msg;
}
/// <summary>
/// FileResponse 的摘要说明
/// </summary>
public class FileResponse : IHttpHandler
{
// extjs submit()
//would process the following server response for a successful submission:
//{
// "success":true, // note this is Boolean, not string
// "msg":"Consignment updated"
//}
//and the following server response for a failed submission:
//{
// "success":false, // note this is Boolean, not string
// "msg":"You do not have permission to perform this operation"
//}
public void ProcessRequest(HttpContext context)
{
result res = new result();
context.Response.ContentType = "text/html";
if (context.Request.Files.Count > 0)
{
res.success = true;
res.msg = "成功上传";
string respone = JSON.Serialize(res);
string fn = context.Request.Files[0].FileName;
//int fl = context.Request.Files[0].ContentLength;
string strPath = context.Server.MapPath("~/") + fn;