asp 图片上传显示成功 但数据库和文件夹中都没有显示
<%dimupload,file,formName,formPath,iCountsetupload=newupload_FfunctionMakedownName()d...
<%
dim upload,file,formName,formPath,iCount
set upload=new upload_F
function MakedownName()
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
MakedownName=fname
end function
formPath="uppic/"
iCount=0
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
newname=MakedownName()&"."&mid(file.FileName,InStrRev(file.FileName, ".")+1)
file.SaveAs Server.mappath(formPath&newname) ''保存文件
dim user_id,action
action=request.QueryString("action")
set rs=server.CreateObject("adodb.recordset")
rs.open"select user_id from f_user where user_name='"&request.Cookies("f_user_name")&"'",conn,1,1
user_id=rs("user_id")
rs.close
set rs=nothing
if action="uppic" then
set rs=server.CreateObject("adodb.recordset")
rs.open"select * from f_photo",conn,1,3
rs.addnew
rs("user_id")=user_id
rs("user_name")=request.Cookies("f_user_name")
rs("p_name")=newname
rs("p_path")=formPath
rs("p_date")=date()
rs("p_see")=0
rs.update
rs.close
set rs=nothing
end if
iCount=iCount+1
else
response.write "未找到文件 <A HREF=javascript:history.back(1)>返回</A>"
response.end
end if
next
set file=nothing
set upload=nothing ''删除此对象
response.Write "<script language=javascript>alert('上传成功!请点确定返回个人中心');location.href='user_photo.asp'</script>"
%> 展开
dim upload,file,formName,formPath,iCount
set upload=new upload_F
function MakedownName()
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
MakedownName=fname
end function
formPath="uppic/"
iCount=0
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
newname=MakedownName()&"."&mid(file.FileName,InStrRev(file.FileName, ".")+1)
file.SaveAs Server.mappath(formPath&newname) ''保存文件
dim user_id,action
action=request.QueryString("action")
set rs=server.CreateObject("adodb.recordset")
rs.open"select user_id from f_user where user_name='"&request.Cookies("f_user_name")&"'",conn,1,1
user_id=rs("user_id")
rs.close
set rs=nothing
if action="uppic" then
set rs=server.CreateObject("adodb.recordset")
rs.open"select * from f_photo",conn,1,3
rs.addnew
rs("user_id")=user_id
rs("user_name")=request.Cookies("f_user_name")
rs("p_name")=newname
rs("p_path")=formPath
rs("p_date")=date()
rs("p_see")=0
rs.update
rs.close
set rs=nothing
end if
iCount=iCount+1
else
response.write "未找到文件 <A HREF=javascript:history.back(1)>返回</A>"
response.end
end if
next
set file=nothing
set upload=nothing ''删除此对象
response.Write "<script language=javascript>alert('上传成功!请点确定返回个人中心');location.href='user_photo.asp'</script>"
%> 展开
2个回答
展开全部
先 看看 文件夹 权限! 、 我想应该是你代码 没加对! 仔细看看教程什么的! 或者 缓一段 图片上传代码!
追问
什么文件权限?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询