没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
完整的代码,有部分注释,应该看的明白...需要你手动设置一下,如 :数据库路径,上传路径等等
代码如下:
<%
if lcase(request("upload"))="true" then
dim upload,file,formName,formPath,iCount
dim upmsg
set upload=new upload_5xSoft
SET conn =SERVER.CREATEOBJECT("ADODB.CONNECTION")
SET rs =SERVER.CREATEOBJECT("ADODB.RECORDSET")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("ss.mdb") '要写入数据库路径
formpath=server.mappath(".") & "\" '上传文件路径
iCount=0
for each formName in upload.file
set file=upload.file(formName)
if file.FileSize>0 then
file.SaveAs formPath & replace(file.FileName," ","")
upmsg=upmsg & vbcrlf & replace(file.FileName," ","") & " 上传成功!"
'开始把上传文件名称写入数据库
rs.open "select * from upload",conn,1,3
rs.addnew
rs("文件名")=formPath & replace(file.FileName," ","")
rs.update
rs.close
'写入数据库结束
iCount=iCount+1
end if
set file=nothing
next
set upload=nothing ''删除此对象
upmsg=upmsg & vbcrlf & iCount&" 个文件上传结束!"
代码如下:
<%
if lcase(request("upload"))="true" then
dim upload,file,formName,formPath,iCount
dim upmsg
set upload=new upload_5xSoft
SET conn =SERVER.CREATEOBJECT("ADODB.CONNECTION")
SET rs =SERVER.CREATEOBJECT("ADODB.RECORDSET")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("ss.mdb") '要写入数据库路径
formpath=server.mappath(".") & "\" '上传文件路径
iCount=0
for each formName in upload.file
set file=upload.file(formName)
if file.FileSize>0 then
file.SaveAs formPath & replace(file.FileName," ","")
upmsg=upmsg & vbcrlf & replace(file.FileName," ","") & " 上传成功!"
'开始把上传文件名称写入数据库
rs.open "select * from upload",conn,1,3
rs.addnew
rs("文件名")=formPath & replace(file.FileName," ","")
rs.update
rs.close
'写入数据库结束
iCount=iCount+1
end if
set file=nothing
next
set upload=nothing ''删除此对象
upmsg=upmsg & vbcrlf & iCount&" 个文件上传结束!"
response.write "<script>" & vbcrlf
upmsg=replace(upmsg,vbcrlf,"")
response.write "ts.innerHTML='';" & vbcrlf
response.write "alert('" & upmsg & "');" & vbcrlf
response.write "location='dd.asp';" & vbcrlf '要返回的地址
response.write "</script>" & vbcrlf
response.end
end if
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
'*********
'*化境上传*
'*********
dim upfile_5xSoft_Stream
Class upload_5xSoft
dim Form,File,Version
Private Sub Class_Initialize
dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile
dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr
if Request.TotalBytes<1 then
Exit Sub
end if
set Form=CreateObject("Scripting.Dictionary")
set File=CreateObject("Scripting.Dictionary")
set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")
upfile_5xSoft_Stream.mode=3
upfile_5xSoft_Stream.type=1
upfile_5xSoft_Stream.open
upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)
vbEnter=Chr(13)&Chr(10)
upmsg=replace(upmsg,vbcrlf,"")
response.write "ts.innerHTML='';" & vbcrlf
response.write "alert('" & upmsg & "');" & vbcrlf
response.write "location='dd.asp';" & vbcrlf '要返回的地址
response.write "</script>" & vbcrlf
response.end
end if
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
'*********
'*化境上传*
'*********
dim upfile_5xSoft_Stream
Class upload_5xSoft
dim Form,File,Version
Private Sub Class_Initialize
dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile
dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr
if Request.TotalBytes<1 then
Exit Sub
end if
set Form=CreateObject("Scripting.Dictionary")
set File=CreateObject("Scripting.Dictionary")
set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")
upfile_5xSoft_Stream.mode=3
upfile_5xSoft_Stream.type=1
upfile_5xSoft_Stream.open
upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)
vbEnter=Chr(13)&Chr(10)
剩余8页未读,继续阅读
资源评论
yupf0407
- 粉丝: 0
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C#,煎饼排序问题(Pancake Sorting Problem)算法与源代码
- C#,排列组合的堆生成法(Heap’s Algorithm for generating permutations)算法与源代码
- C#,老鼠迷宫问题的回溯法求解(Rat in a Maze)算法与源代码
- 6693eeb8d683458a07938615fba9e68f.apk
- C#,数值计算,解微分方程的龙格-库塔二阶方法与源代码
- C#,数值计算,用割线法(Secant Method)求方程根的算法与源代码
- C#,子集和问题(Subset Sum Problem)的算法与源代码
- mongodb 数据库基本操作
- Linux操作系统基础教程
- Linux操作系统相关习题集
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功