publicbool UploadImg(byte[] fileBytes,string path)
{
try
{
//文件保存目录路径
String savePath ="/upload/";
String dirPath
= Server.MapPath(savePath);

FileInfo ff
=new FileInfo(dirPath+path);
if (!ff.Directory.Exists) Directory.CreateDirectory(ff.DirectoryName);
System.IO.FileStream fs
= System.IO.File.Create(dirPath+path);
fs.Flush();
fs.Write(fileBytes,
0, fileBytes.Length);
fs.Close();
fs.Dispose();
returntrue;
}
catch
{
returnfalse;
}
}
posted on 2011-07-05 15:15  阿拉伯顶峰  阅读(187)  评论(0编辑  收藏  举报