把上传文件按月份文件夹存放,方便管理
作者:cmscn 日期:2008-08-20
原帖:http://www.joekoe.com/forum/view_93794.html
1.修改jk_class.asp文件
查找
以下为代码内容:
case 5 '2003年10月10日
time_type=d_year&"年"&d_month&"月"&d_day&"日"
在下面添加
以下为代码内容:
case 6 '200310
time_type=d_year&d_month
2.修改upload.asp文件
查找
以下为代码内容:
if right(upload_path,1)<>"/" then upload_path=upload_path&"/"
call upload_val_folder(upload_path,up_path) '验证文件夹是否存在
up_path=server.mappath(upload_path&up_path)
if right(up_path,1)<>"/" then up_path=up_path&"/"
改为
以下为代码内容:
if right(upload_path,1)<>"/" then upload_path=upload_path&"/"&joekoe_cms.time_type(now(),6)&"/"
call upload_val_folder(upload_path,up_path) '验证文件夹是否存在
up_path=server.mappath(upload_path&up_path)
if right(up_path,1)<>"/" then up_path=up_path&"/"&joekoe_cms.time_type(now(),6)&"/"
查找
以下为代码内容:
sub upload_data()
dim uiid,unsort,utypes
uiid=0
unsort=""
utypes=0
sql="select id from upload where url='"&uppath&"/"&upfile_name&"'"
if session(session_for&"uploadtype")="s" then
uiid=int(login_id)
unsort="uface"
utypes=1
sql="select id from upload where iid="&uiid&" and nsort='"&unsort&"'"
改为
以下为代码内容:
sub upload_data()
dim uiid,unsort,utypes
uiid=0
unsort=""
utypes=0
sql="select id from upload where url='"&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"'"
if session(session_for&"uploadtype")="s" then
uiid=int(login_id)
unsort="uface"
utypes=1
sql="select id from upload where iid="&uiid&" and nsort='"&unsort&"'"
查找
以下为代码内容:
sql="insert into upload(iid,nsort,types,username,url,genre,sizes,tim) " & _
"values("&uiid&",'"&unsort&"',"&utypes&",'"&login_username&"','"&uppath&"/"&upfile_name&"','"&upfile_name2&"',"&upfilesize&",'"&joekoe_cms.now_time&"')"
call joekoe_cms.exec(sql,0)
改为
以下为代码内容:
sql="insert into upload(iid,nsort,types,username,url,genre,sizes,tim) " & _
"values("&uiid&",'"&unsort&"',"&utypes&",'"&login_username&"','"&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"','"&upfile_name2&"',"&upfilesize&",'"&joekoe_cms.now_time&"')"
call joekoe_cms.exec(sql,0)
查找
以下为代码内容:
call joekoe_cms.exec("update upload set username='"&login_username&"',sizes="&upfilesize&",tim='"&joekoe_cms.now_time&"',url='"&uppath&"/"&upfile_name&"' where id="&rs("id"),0)
改为
以下为代码内容:
call joekoe_cms.exec("update upload set username='"&login_username&"',sizes="&upfilesize&",tim='"&joekoe_cms.now_time&"',url='"&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"' where id="&rs("id"),0)
查找
以下为代码内容:
case 4
uptemp=vbcrlf&"<font class=red>上传成功</font>:<a href='"&upload_path&uppath&"/"&upfile_name&"' target=_blank>"&upfile_name&"</a> ("&upfilesize&"Byte)"
改为
以下为代码内容:
case 4
uptemp=vbcrlf&"<font class=red>上传成功</font>:<a href='"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"' target=_blank>"&upfile_name&"</a> ("&upfilesize&"Byte)"
查找
以下为代码内容:
if uppath="face" then
tmpjs=tmpjs&"parent.document.all."&up_text&".value='"&upload_path&uppath&"/"&upfile_name&"';"
upid=0
else
tmpjs=tmpjs&"parent.document.all."&up_text&".value='"&uppath&"/"&upfile_name&"';"
end if
改为
以下为代码内容:
if uppath="face" then
tmpjs=tmpjs&"parent.document.all."&up_text&".value='"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"';"
upid=0
else
tmpjs=tmpjs&"parent.document.all."&up_text&".value='"&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"';"
end if
查找(把{改成[)
以下为代码内容:
case "gif","jpg","bmp","png"
tmpjs=tmpjs&"{IMG]"&upload_path&uppath&"/"&upfile_name&"{/IMG]"
case "swf"
tmpjs=tmpjs&"{FLASH=350,250]"&upload_path&uppath&"/"&upfile_name&"{/FLASH]"
case else
tmpjs=tmpjs&"{DOWNLOAD]"&upload_path&uppath&"/"&upfile_name&"{/DOWNLOAD]"
end select
改为(把{改成[)
复制内容到剪贴板 程序代码
case "gif","jpg","bmp","png"
tmpjs=tmpjs&"{IMG]"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"以下为代码内容:
{
/IMG]"
case "swf"
tmpjs=tmpjs&"{FLASH=350,250]"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"以下为代码内容:
{
/FLASH]"
case else
tmpjs=tmpjs&"{DOWNLOAD]"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"以下为代码内容:
{
/DOWNLOAD]"
end select
tmpjs=tmpjs&"{IMG]"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"以下为代码内容:
{
/IMG]"
case "swf"
tmpjs=tmpjs&"{FLASH=350,250]"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"以下为代码内容:
{
/FLASH]"
case else
tmpjs=tmpjs&"{DOWNLOAD]"&upload_path&uppath&"/"&joekoe_cms.time_type(now(),6)&"/"&upfile_name&"以下为代码内容:
{
/DOWNLOAD]"
end select
查找
以下为代码内容:
sub upload_val_folder(uf_upload,uf_uppath)
dim myfso,myfile,up_path
set myfso=createobject("scripting.filesystemobject")
if uf_uppath<>"" then
myfile=server.mappath(uf_upload&uf_uppath)
if not myfso.folderexists(myfile) then
set up_path=myfso.createfolder(myfile)
end if
end if
set myfso=nothing
end sub
改为
以下为代码内容:
sub upload_val_folder(uf_upload,uf_uppath)
dim myfso,myfile,up_path
set myfso=createobject("scripting.filesystemobject")
if uf_uppath<>"" then
myfile=server.mappath(uf_upload&uf_uppath&"/"&joekoe_cms.time_type(now(),6))
if not myfso.folderexists(myfile) then
set up_path=myfso.createfolder(myfile)
end if
end if
set myfso=nothing
end sub
评论: 0 | 引用: 0 | 查看次数: 456
发表评论