62,244
社区成员




<form method="post" enctype="multipart/form-data" action="picup.ashx">
<input type="file" />
<input type="submit" value="上传">
</form>
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.IO;
public class Handler : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
HttpFileCollection hfc=context.Request.Files;
HttpPostedFile upfile = hfc[0];
upfile.SaveAs(context.Server.MapPath("test.file"));
if (hfc[0].InputStream!=null) hfc[0].InputStream.Close();
}
public bool IsReusable
{
get {return true;}
}
}