日期:2014-05-16  浏览次数:20558 次

急! WebClient上传图片总是打不开
A项目一般处理程序上传代码:
 MemoryStream ms;
        public void ProcessRequest(HttpContext context)
        {
            string _filedir = context.Server.MapPath(@"/Styles/images/");
            try
            {
                string result = "3";
                int cout = context.Request.Files.Count;
                if (cout > 0)
                {
                    HttpPostedFile hpf = context.Request.Files[0];
                    if (hpf != null)
                    {
                        string fileExt = Path.GetExtension(hpf.FileName).ToLower();
                        //只能上传文件,过滤不可上传的文件类型  
                        string fileFilt = ".gif|.jpg|.php|.jsp|.jpeg|.png|......";
                        if (fileFilt.IndexOf(fileExt) <= -1)
                        {
                            result= "1";
                        }
                        int length = hpf.ContentLength; //判断文件大小 
                        if (length > 204800)
                        {
                            result= "2";
                        }
                        byte[] bt&n