1、 -2)设置上传的文件夹名 formpath=uploadfile/ uploadfile/可以根据爱好等进行修改成,一旦这样设置,需要在babyadmingoods文件夹下创建uploadfile文件夹。3)增加picname=up_pic() 调用up_pic()函数,返回文件名 再把所有类似pname=request.form(pname)改为 pname=upload.form() 4)修改后的goodsadd.asp的代码视图如下:conn.asp-%管理员身份验证if not(session(key)=sa or session(bdbsbjbc) then response.re
2、direct ./index.asp response.endend if%这是处理提交过来的数据的页面 formpath= 设置上传的文件夹名 url=index.asp上传完后,返回到的页面。set upload= new upload_5xsoft 实例化一个上传对象upload,这个无组件上传类最大只能上200K的文件,上传超过200K文件,将会非常的慢,如果想上传更大的文件,可以使用有组件上传 function up_pic() 这是一个上传函数 iCount=0记录上传图片数 for each formName in upload.objFile 列出所有上传了的文件 set fi
3、le=upload.file(formName) 生成一个文件对象 intFileSize=file.FileSize if file.FileSize0 and file.filesize 0 说明有文件数据 FileNameext = LCase(Right(file.fileName,4) 最文件名的后四位字符,并转成小写 if FileNameext=.jpg or FileNameext=.gif.GIF.JPGthen 判断图片的格式,你也可以去掉不判断 Pic_Name=file.fileName 将文件名赋值给变量Pic_Name file.SaveAs Server.mapp
4、ath(formPath&file.FileName) 保存文件 iCount=iCount+1 else response.write script language=javascriptalert(你上传的图片格式不正确); response.write history.go(-1); response.write /script response.end end if else if file.filesize2621440 then 如果文件大于256K,这个数值你可以自己算2561024 上传的图片大于256K,上传失败! response.write response.write
5、response.end end if set file=nothing next up_pic=Pic_Name 本函数的作用是,将上传的图片上传到文件夹中,并将文件名返回 end function htmlheadtitle添加新数据meta http-equiv=content-type content=text/html; charset=gb2312link href=style.css rel=stylesheet type=text/css/headbody bgcolor=4189dd leftmargin=0 topmargin= marginwidth= marginhei
6、ght=p /ptable width=80% border= align=center cellpadding= cellspacing=2 bgcolor=00209f td bgcolor=a9c7ec100%td height=30#ffffffdiv align=欢迎使用img src=././image/di02.gif width=95 height=26absmiddle后台管理系统/td/trtd p align=font color=#ff3300strong数据提交成功!/strong/fonta href=goodsaddform.asp/a版权所有: 如遇到程序使用问题请及时与程序管理员联系/body/html
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1