<%@ WebHandler Language="C#" Class="pdfHandler" %> using System; using System.Web; using System.IO; using System.Drawing; using System.Drawing.Drawing2D; public class pdfHandler : IHttpHandler { public void ProcessRequest (HttpContext context) { if (context.Request.Files.Count > 0) { HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; string fname,path; int filesize = file.ContentLength; //if(filesize <= 500) //{ if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE" || HttpContext.Current.Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER") { string[] testfiles = file.FileName.Split(new char[] { '\\' }); fname = testfiles[testfiles.Length - 1]; } else { fname = file.FileName; } //fname=Path.Combine(context.Server.MapPath("AgentImage/"), fname); path=Path.Combine(context.Server.MapPath("AgentImage/"), fname); file.SaveAs(path); context.Response.Write("AgentImage/" + fname); } } context.Response.ContentType = "text/plain"; } //} public bool IsReusable { get { return false; } } }