FoosunCMS-远程存图按日期目录存放

来自站长百科
跳转至: 导航、​ 搜索

导航:返回上一页

FoosunCMS-远程存图按日期目录存放


方法: 1、修改图片新闻文件:admin/Info/NewsPic.asp

A、查找: If ISavePic = "1" then
  INewsAddObj("Content") = ReplaceRemoteUrl
(Save_Content,"/" & UpFiles & "/" & 
BeyondPicDir,RsNewsConfigObj("DoMain"),DummyPath_Riker)
Else
  INewsAddObj("Content") = Save_Content   '新闻内容 尚未判断
End If
B、以及文字新闻文件:admin/Info/NewsWords.asp
If ISavePic = "1" then
  INewsAddObj("Content") = ReplaceRemoteUrl
(Save_Content,"/" & UpFiles & "/"&
BeyondPicDir,RsNewsConfigObj("DoMain"),DummyPath_Riker)
else
  INewsAddObj("Content") = Save_Content
End If
替换成:
If ISavePic = "1" then
  INewsAddObj("Content") = 
ReplaceRemoteUrl
(Save_Content,"/" 
& UpFiles & "/"&BeyondPicDir 
& "/" & year(now) 
& "-" & month(now) 
& "-" & day(now),
RsNewsConfigObj("DoMain"),DummyPath_Riker)
else
  INewsAddObj("Content") = Save_Content
End If
2、修改网站根目录下Inc/Function.asp 
(非admin/inc/function.asp文件)
A、查找Function ReplaceRemoteUrl
(NewsContent,SaveFilePath,FunDoMain,DummyPath)
在此函数里添加:(比如在 Set re = Nothing 下面加)
  AutoCreateFolder(Server.MapPath(SaveFilePath))
B、添加函数:
'================================================
'按月份自动明名上传文件夹,需要FSO组件支持。
' 自动创建指定的多级文件夹
' strPath为绝对路径
' 引用请保留版权
' by im286_Anjer
' 2005-4-3
' http://www.ggmo.net
'调用方法:AutoCreateFolder("C:\a\b\c")
'================================================
Function AutoCreateFolder(strPath) ' As Boolean
        On Error Resume Next

        Dim astrPath, ulngPath, i, strTmpPath
        Dim objFSO

        If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then
                AutoCreateFolder = False
                Exit Function
        End If
        Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
        If objFSO.FolderExists(strPath) Then
                AutoCreateFolder = True
                Exit Function
        End If
        astrPath = Split(strPath, "\")
        ulngPath = UBound(astrPath)
        strTmpPath = ""
        For i = 0 To ulngPath
                strTmpPath = strTmpPath & astrPath(i) & "\"
If Not objFSO.FolderExists(strTmpPath) Then
                        ' 创建
                        objFSO.CreateFolder(strTmpPath)
                End If
        Next
        Set objFSO = Nothing
        If Err = 0 Then
                AutoCreateFolder = True
        Else
                AutoCreateFolder = False
        End If
End Function 

3、附上已修改好的文件for SP1 [请到本文讨论区下载](使用方法:直接覆盖到相应目录即可)




参考来源[ ]