标题:新手使用 ASP 上传代码,出现了问题,请帮忙
只看楼主
ryanjulien
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-7-13
 问题点数:0 回复次数:1 
新手使用 ASP 上传代码,出现了问题,请帮忙
照片可以上传至服务器,并且显示responsewrite,但是数据添加不进数据库

<!--#include file="UpLoad_Class.asp"-->
<%
dim upload
set upload = new AnUpLoad
upload.Exe = "*"upload.
MaxSize = 10 * 1024 * 1024
upload.GetData()
if upload.ErrorID>0 then
response.Write
upload.Description
else
response.Write "你的名字:" & upload.forms("Mingzi") & "<br />"
response.Write "所在部门:" & upload.forms("Bumen") & "<br />"
dim file,savepath
savepath = "upload"
set file = upload.files("file1")
if file.isfile then
result = file.saveToFile(savepath,0,true)
if result then
response.Write  "文件'" & file.LocalName & "'上传成功,保存位置'" & server.MapPath(savepath & "/" & file.filename) & "',文件大小" & file.size & "字节"
else
response.Write file.Exception

dim conn,rsset conn=Server.CreateObject("ADODB.Connection")
conn.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath("infodata.mdb")
set rs=server.CreateObject("adodb.recordset")   
rs.open "select * from infodata",conn,1,3
rs.addnewrs("Mingzi")=Mingzi
rs("Bumen")=Bumen
rs("Zhaopian")=file.filename
rs.update
rs.closeset
rs=nothing
conn.Close
set conn=nothing
end if
end if
end if
set upload = nothing
%>
搜索更多相关主题的帖子: include 服务器 数据库 照片 file 
2014-07-13 17:48
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
得分:0 
检查数据库连接,记得上传文件时,那里的提交表单,不能简单的 request.form  request.querystring

具体网上找源码,看。

ASP讨论QQ群:251346273
2014-07-15 15:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-433994-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.156699 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved