fix:升级
This commit is contained in:
@@ -462,5 +462,64 @@ namespace BLL
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取附件数据流类 多附件的情况
|
||||
/// </summary>
|
||||
/// <param name="attachUrl">附件路径</param>
|
||||
/// <returns></returns>
|
||||
public static List<byte[]> GetMoreFileStructByAttachUrl(string attachUrl)
|
||||
{
|
||||
List<byte[]> fileContext = new List<byte[]>();
|
||||
try
|
||||
{
|
||||
if (!String.IsNullOrEmpty(attachUrl))
|
||||
{
|
||||
string physicalpath = ConfigurationManager.AppSettings["localRoot"];
|
||||
string filePath = string.Empty;
|
||||
string[] strs = attachUrl.Trim().Split(',');
|
||||
foreach (var item in strs)
|
||||
{
|
||||
//HttpContext.Current.Request.PhysicalApplicationPath;
|
||||
filePath = physicalpath + item;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
fileContext.Add(fileConvertByte(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string a = ex.Message;
|
||||
}
|
||||
return fileContext;
|
||||
}
|
||||
|
||||
#region 附件转换二进制数据(用于保存数据库)
|
||||
/// <summary>
|
||||
/// 附件转换二进制数据(用于保存数据库)
|
||||
/// </summary>
|
||||
/// <param name="filePath">附件路径</param>
|
||||
/// <returns>二进制</returns>
|
||||
public static byte[] fileConvertByte(string filePath)
|
||||
{
|
||||
string physicalpath = (ConfigurationManager.AppSettings["localRoot"] + "\\" + filePath).Replace("\\\\", "\\");
|
||||
byte[] bytContent = null;
|
||||
System.IO.FileStream fs = null;
|
||||
System.IO.BinaryReader br = null;
|
||||
try
|
||||
{
|
||||
fs = new FileStream(physicalpath, System.IO.FileMode.Open);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
br = new BinaryReader((Stream)fs);
|
||||
bytContent = br.ReadBytes((Int32)fs.Length);
|
||||
fs.Dispose();
|
||||
return bytContent;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user