日期:2014-05-16 浏览次数:21080 次
'==========================
set FileUP=new Upload_file
FileUP.GetDate(-1)
'==========================
'title=request("title")
title=FileUP.from("title")'用组件获取
if len(title)<=0 then
response.Write "<script>alert('请输入标题名称');history.go(-1)</script>"
response.End()
end if
'==========不需要了,组件生成文件名了,而且直接request("pic")也获取不到
'pic=request("pic")
'if pic="" then
'response.Write "<script>alert('请选择上传图片');history.go(-1)</script>"
'response.End()
'end if
call loadfile(pic)
'isfb=request("isfb")
isfb=FileUP.from("isfb")'用组件获取
'kigs=request("kigs")
kigs=FileUP.from("kigs")'用组件获取
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from dh_design_sample",conn,1,3
rs.addnew
rs("title")=title
rs("pic")=filename
rs("cktime")=now()
rs("isfb")=isfb
rs("kigs")=kigs
rs.update
rs.close
set rs=nothing
response.Redirect "design_sample.asp"
response.End()
dim filename
function loadfile(v)
'set FileUP=new Upload_file '=========放外面去
'FileUP.GetDate(-1)'=========放外面去
formPath="../../upload_location/"
set file=FileUP.file(v)
filename=formPath&"dhupfile"&right(year(now),2)&month(now)&day(now)&hour(now)&minute(now)&second(now)&"."&file.FileExt
if file.filesize > 5*1024*1024 then
response.Write "<script>alert('温馨提示:\n\n文件大小不得超过5M,当前的文件大小为 "&int(file.filesize/1024)&" KB,请您重新上传。');history.go(-1)"
end if
if LCase(file.FileExt)="gif" or LCase(file.FileExt)="jpg" or LCase(file.FileExt)="swf" or LCase(file.FileExt)="png" then
img=""&filename&""
else
response.Write "<script>alert('温馨提示:\n\n上传文件只支持GIF、JPG、swf、png格式,不支持"&file.FileExt&" 格式的文件,请您重新上传。');history.go(-1)</scrip