/******************************************************************************** ** auth: DBS ** date: 2019/3/6 9:50:09 ** desc: 尚未编写描述 ** Ver.: V1.0.0 *********************************************************************************/ using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HH.WMS.Common{ public static class FileUtils { #region 保存文件 /// /// 保存文件 /// /// 文件字节 /// 保存路径 /// 文件名 /// public static string SaveFile(byte[] file, string path, string fileName) { try { var filename = fileName; var filePath = string.Format(@"{0}\{1}", path, filename); //保存完整路径 var fullpath = filePath; //流写入路径 //创建文件 using (var ms = new MemoryStream()) { MemoryStream m = new MemoryStream(file); string files = string.Format(@"{0}", fullpath); FileStream fs = new FileStream(files, FileMode.OpenOrCreate); m.WriteTo(fs); m.Close(); fs.Close(); m = null; fs = null; return fullpath; } } catch (Exception) { return ""; } } #endregion } }