新人求教
我在用asp上传文件,数据库为sqlserver。在上传文件时,我想上传的文件存在各自对应的文件夹里,比如id为1的账号上传文件后,文件保存在名字为1的文件夹里。现在我只能保存在对应的月份文件夹里,无法读取数据库当前id并把它命名为文件夹名字。求帮忙。
代码
<%OPTION EXPLICIT%>
<%
dim zfs,fs,f,y,a,x
dim qsqh
qsqh=request.QueryString("SQH")
set zfs=Server.CreateObject("Scripting.FileSystemObject")
if zfs.FolderExists("D:\Miao\20160728\ISOAPdemo\files\"&a)=true then '判断文件夹是否存在。
response.write("文件夹存在!")
else
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=nothing
set fs=nothing
end if
set zfs=nothing
%>
<%
dim upfile,formPath,ServerPath,FSPath,formName,FileName,oFile,upfilecount
upfilecount=0
session("uwjm1")=""
set upfile=new clsUp ''建立上传对象
upfile.NoAllowExt="asp;exe;html;aspx;cs;vb;js;aspx;" '设置上传类型的黑名单
upfile.GetData (51200000) '取得上传数据,限制最大上传5M
%>
文件上传 <!-- .p9{ font-size: 9pt; font-family: 宋体 } -->
<%
if upfile.isErr then '如果出错
select case upfile.isErr
case 1
Response.Write "你没有上传数据呀???是不是搞错了??"
case 2
Response.Write "你上传的文件超出我们的限制,最大5MB"
end select
else
%>
<%
dim FileExt,getid,getsqh,gettype,fileallname
dim getd,geth,getm,gets
geth=hour(now())
getm=minute(now())
gets=second(now())
FSPath=GetFilePath(Server.mappath("upfile.asp"),"\")'取得当前文件在服务器路径
ServerPath=GetFilePath(Request.ServerVariables("HTTP_REFERER"),"/")'取得在网站上的位置
for each formName in upfile.file '列出所有上传了的文件
set oFile=upfile.file(formname)
FileName=upfile.form(formName)'取得文本域的值
getid=upfile.form("uploadid")
getsqh=upfile.form("uploadsqh")
gettype=upfile.form("types2")
FileExt=LCase(upfile.file(formname).FileExt)'小写后缀名
if not FileName>"" then FileName=oFile.filename。。。。。。。