哎再求一个大家烦的不能再烦的问题,无组件文件上传到文件夹同时混合上传表单项到数据库

seaonce 2004-04-10 01:51:10
稻香老农的我怎么看着也是只上传文件,没涉及上传表单项啊
...全文
84 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
seaonce 2004-04-10
  • 打赏
  • 举报
回复
终于搞定了

谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢
seaonce 2004-04-10
  • 打赏
  • 举报
回复
Microsoft VBScript 运行时错误 错误 '800a01b6'

对象不支持此属性或方法: 'objFile'

/moban1/product-1.asp,行39

这是怎么回事啊
snowleaf 2004-04-10
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2933/2933833.xml?temp=.5429193
lawdoor 2004-04-10
  • 打赏
  • 举报
回复
如何??
lawdoor 2004-04-10
  • 打赏
  • 举报
回复

简单说明:
本例是相册里像片的上传。
其中的groupID是隐藏域传递的大类的ID
其中的albumID是隐藏域传递的小类的ID
file1-->>file5是文件
photoTitle1-->>photoTitle5 是像片的标题
photoIntro1-->>photoIntro5 是像片的简介
photoWidth1-->>photoWidth5 是像片的宽度
photoHeight1-->>photoHeigth5 是像片的高度
photoSize1-->>photoSize5 是像片的大小。

提交页面
=============
请见
www.blueidea.com/bbs/newsdetail.asp?id=1249224&posts=current
==================================================

处理页面
====================================
<%@ CODEPAGE="936"%>
<%
Server.ScriptTimeOut=5000 '--脚本超时设置为5000
%>
<!--#include file="conn.asp" -->
<!--#include FILE="upload_5xsoft.inc"-->

<%
set upload=new upload_5xsoft '建立上传对象

formPath="upfile/" '--上传路径

upFileSize=1048576 '设置文件限制为1M

iCount=0 '--上传文件个数的计数

'-----------检查是否有在此位置上传的权限--------这里省略。。。。
groupID=trim(upload.form("groupID"))
albumID=trim(upload.form("albumID"))
'-----------检查权限完成------

if errMsg="" then '--如果以上的检查没有错误,那么继续
for each formName in upload.objFile '列出所有上传了的文件
set file=upload.file(formName) '生成一个文件对象
if file.FileSize>0 then '如果 FileSize > 0 说明有文件数据
fileOK=1
fileExt=lcase(right(file.Filename,4))
'===================检查后缀名=====
if LCase(fileEXT)<>".gif" and LCase(fileEXT)<>".jpg" and LCase(fileEXT)<>".bmp" and LCase(fileEXT)<>".png" then
errMsg=errMsg+"文件:"&file.Filename&" 不是图片文件!<br>"
fileOK=0
end if
'==========检查文件大小=====
if file.FileSize>upFileSize then
errMsg=errMsg+"文件:"&file.Filename&" 的大小大于"&upFileSize\1024&"KB!<br>"
fileOK=0
end if
if fileOK=1 then '--如果通过检查,那么保存文件
randomize
ranNum=int(900*rnd)+100
filename=year(now())&month(now())&day(now())&hour(now())&minute(now())&second(now())&ranNum&fileExt
file.SaveAs Server.mappath(formPath&filename) '让文件名不重复,保存文件
'===添加文件的信息到数据库里===
myIndex=right(formName,1) '--取得序号,如file1取得为1,file2取得为2
temp_photoTitle=upload.form("photoTitle"+myIndex) '--这四行取得文件对应的标题,简介,宽度,高度等
temp_photoIntro=upload.form("photoIntro"+myIndex)
temp_photoWidth=upload.form("photoWidth"+myIndex)
temp_photoHeight=upload.form("photoHeight"+myIndex)
'========检查输入,为空则给初值===
temp_photoTitle=replace(trim(temp_photoTitle),"'","''")
if temp_photoTitle="" then
temp_photoTitle="没有填写"
end if
temp_photoIntro=replace(trim(temp_photoIntro),"'","''")
if temp_photoIntro="" then
temp_photoIntro="没有填写"
end if
if temp_photoWidth="" or not IsNumeric(temp_photoWidth) then
temp_photoWidth=160
end if
if temp_photoHeight="" or not IsNumeric(temp_photoHeight) then
temp_photoHeight=120
end if
'=======插入数据库===
sql="insert into TBL_PHOTO(albumID,groupID,userName,addTime,photoFilename,photoTitle,photoIntro,photoClick,photoSize,photoWidth,photoHeight,locked,viewPassword) values("&albumID&","&groupID&",'"&session("userName")&"','"&Now()&"','"&filename&"','"&temp_photoTitle&"','"&temp_photoIntro&"',1,"&file.FileSize&","&temp_photoWidth&","&temp_photoHeight&",'no','')"
conn.execute sql
sql="update TBL_ALBUM set photoCount=photoCount+1 where albumID="&albumID
conn.execute sql
sql="update TBL_GROUP set photoCount=photoCount+1 where groupID="&groupID
conn.execute sql
'======输出上传成功信息===
response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&filename&" 成功!<br>"
iCount=iCount+1
end if
end if
set file=nothing
next
end if
set upload=nothing ''删除此对象
response.write "<br>"&iCount&" 个文件上传结束!"
response.write "<br><a href='photo_listphoto.asp?albumID="&albumID&"'><B>返回相册</B></a>"
'=============如果有错,输出错误信息=========
if errMsg<>"" then
response.write "<br>"&errMsg
response.write "<INPUT type='button' onClick='history.go(-1)' value='返回' class='myInput'>"
end if
conn.close
set conn=nothing
%>
seaonce 2004-04-10
  • 打赏
  • 举报
回复
没人是吧
我顶

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧