首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

改变图象大小后保存,出现GDI+中发生一般性异常

2011-12-14 
改变图象大小后保存,出现GDI+中发生一般性错误HttpPostedFilefilefileupbmp.PostedFilestringimageurlS

改变图象大小后保存,出现GDI+中发生一般性错误
HttpPostedFile   file   =   fileupbmp.PostedFile;
                  string   imageurl   =   Server.MapPath( "../images/TreeImage/ "   +         fileupbmp.FileName);

                  file.SaveAs(imageurl);
                  System.Drawing.Image   imgOutput   =   System.Drawing.Bitmap.FromFile(imageurl);
                  System.Drawing.Image   imgOutput2   =   imgOutput.GetThumbnailImage(18,   18,   null,   IntPtr.Zero);
                  imgOutput2.Save(imageurl);//出现“GDI+中发生一般性错误”
                  imgBmp.ImageUrl   =   "../images/TreeImage/ "   +   fileupbmp.FileName;
                  imgOutput.Dispose();
                  imgOutput2.Dispose();

[解决办法]
imgOutput2.save前,先把imgOutput释放了,资源占用了
[解决办法]
imgOutput2.Save(imageurl);//出现“GDI+中发生一般性错误”

images/TreeImage/

这是由于你的 images/TreeImage/ 文件夹没有写入的权限造成的。
你给这个文件夹加上 everyone 的完全控制权限。(很不安全哦,哈哈)


热点排行