关于CreateObject("Adodb.Stream")的问题
我想上传文件的时候在数据库中只保存相对路径,如../upfile. 而不是http://127.0.0.1/upfile. 请问有没有好的方法?
if file.FileSize>0 then
file.SaveAs Server.mappath(FileName) ////取路径
if methods = 1 then
response.write "<script>parent.WBTB_Composition.document.body.innerHTML+='<br><a href="& filename &"><img border=0 src=images/"&fileEXT&".gif>点击下载浏览该文件"& filename &"</a>'</script>"
else
response.write "<script>parent.WBTB_Composition.document.body.innerHTML+='<br><img border=0 src="&filename&">'</script>"
end if
end if
function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=1
if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function
if FileStart=0 or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
upfile_5xSoft_Stream.position=FileStart-1
upfile_5xSoft_Stream.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=0
end function