首页 > 网站 > 建站经验 > 正文

远程存图按日期目录存放

2024-08-30 19:06:07
字体:
来源:转载
供稿:网友

本文讨论区:http://bbs.foosun.net/dispbbs.asp?boardID=22&ID=7958&page=1

方法:
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) & "/"9 7 3 12 4 8 :

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表