diff --git a/SGGL/BLL/Common/AttachFileService.cs b/SGGL/BLL/Common/AttachFileService.cs
index c83c54f..7ada4c2 100644
--- a/SGGL/BLL/Common/AttachFileService.cs
+++ b/SGGL/BLL/Common/AttachFileService.cs
@@ -454,5 +454,37 @@ namespace BLL
}
}
#endregion
+
+ ///
+ /// 判断文件类型是否支持的预览
+ ///
+ ///
+ ///
+ public static bool IsSupportFileType(string FiletExtension)
+ {
+ bool result = false;
+ List list = new List();
+ list.Add("doc");
+ list.Add("docx");
+ list.Add("pdf");
+ list.Add("txt");
+ list.Add("xlsx");
+ list.Add("xls");
+ list.Add("jpg");
+ list.Add("png");
+ list.Add("gif");
+ list.Add("jpeg");
+ foreach (var item in list)
+ {
+ if (item == FiletExtension)
+ {
+ result = true;
+ break;
+ }
+ }
+
+ return result;
+
+ }
}
}
diff --git a/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs b/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs
index 6f46f0a..4797117 100644
--- a/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs
+++ b/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs
@@ -346,6 +346,7 @@ namespace FineUIPro.Web.AttachFile
{
string savedName = item.Value("savedName");
string folder = item.Value("folder");
+ string type = item.Value("type");
string xnUrl = AttachPath + "\\" + savedName;
if (!string.IsNullOrEmpty(folder))
{
@@ -363,28 +364,41 @@ namespace FineUIPro.Web.AttachFile
url = Funs.RootPath + "Images//Null.jpg";
info = new FileInfo(url);
}
- var FiletExtension = Path.GetExtension(savedName);
- if (FiletExtension == ".docx" || FiletExtension == ".pdf")
- {
- string httpUrl = BLL.AsposeWordHelper.WordToHtml(url);
- PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
- }
- else if (FiletExtension == ".txt")
+ bool isSupportType = AttachFileService.IsSupportFileType(type);
+ if (isSupportType)
{
-
+ url = url.Replace(Funs.RootPath, "").Replace("#", "%23");
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", url, "查看 -")));
}
- else if (FiletExtension == ".xls")
- {
- string httpUrl = BLL.AsposeWordHelper.PriviewExcel(url);
-
- PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
- }
else
{
ShowNotify("不支持预览", MessageBoxIcon.Warning);
+
}
+
+ //var FiletExtension = Path.GetExtension(savedName);
+ //if (FiletExtension == ".docx" || FiletExtension == ".pdf")
+ //{
+ // string httpUrl = BLL.AsposeWordHelper.WordToHtml(url);
+ // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
+
+ //}
+ //else if (FiletExtension == ".txt")
+ //{
+
+ // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", url, "查看 -")));
+ //}
+ //else if (FiletExtension == ".xls")
+ //{
+ // string httpUrl = BLL.AsposeWordHelper.PriviewExcel(url);
+
+ // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/Look.aspx?fileUrl={0}", httpUrl, "查看 -")));
+ //}
+ //else
+ //{
+ // ShowNotify("不支持预览", MessageBoxIcon.Warning);
+ //}
}
catch (Exception)
{