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;
}
}
{
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;
}
}