您的位置:程序门 -> web 开发 -> asp



100分请高手帮忙看代码……!谢谢了!提示错误是 语法错误


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


100分请高手帮忙看代码……!谢谢了!提示错误是 语法错误
发表于:2007-08-21 10:36:17 楼主

语法错误
/manage/common/files/example/upload_5xsoft.inc,   line   11
class   upload_5xsoft
---------------------------------

<%@language= "vbscript "   codepage= "936 "%>
<!--#include   virtual= "/manage/common/files/example/upload_5xsoft.inc "-->  
<!--#include   virtual= "/db/splimit.asp "-->
<meta   http-equiv= "content-type "   content= "text/html;   charset=gb2312 ">

<%if   session( "admin ")= " "   then   response.redirect( "/manage/login.asp ")%>
<!--#include   virtual= "/db/conn.asp "-->
<!--#include   virtual= "/db/functions/pdm_a.asp "--> <%if   getpdma(session( "admin "), "特价商情管理 ")=false   then
cnoff
response.redirect( "/manage/error.asp?id=2000 ")
end   if

dim   upload,file,filepath,formname
filepath= "pics/ "
set   upload=new   upload_5xsoft   ' '建立上传对象
for   each   formname   in   upload.file   ' '列出所有上传了的文件
  set   file=upload.file( "pic ")     ' '生成一个文件对象
  if   file.filesize> 0   and   file.filesize <50240   then                   ' '如果   filesize   >   0   说明有文件数据
file.saveas   server.mappath(filepath&fname)       ' '保存文件
    fname   =   makefilename(now())& "_ "&file.filename
  fname   =   file.filename
    end   if
id =upload.form( "mid ")
if   id= " "   or   (not   isnumeric(id))   then   id=0
nm =   upload.form( "nm ")
sn =   " "&upload.form( "sn ")
bd =   " "&upload.form( "bd ")
np =   " "&upload.form( "np ")
op =   " "&upload.form( "op ")
nb =   " "&upload.form( "nb ")
tp =   " "&upload.form( "tp ")
nk =   " "&upload.form( "nk ")
rm =   " "&upload.form( "rm ")
tm =   upload.form( "tm ")
top   =   " "&upload.form( "g_top ")
g_fl_su   =   " "&upload.form( "g_fl_su ")
g_picpath   =   " "&filepath&fname


if   isnumeric(tm)   then
if   tm> 0   and   tm   <20   then
tm=tm=cdate(date()+tm)
end   if
end   if
if   not   isdate(tm)   then   tm=cdate(date()+2)


set   rs=server.createobject( "adodb.recordset ")
rs.open   "select   *   from   [goods]   where   g_id= "&id,cnmain,1,3
if   rs.bof   then   rs.addnew
rs( "g_name ") =   nm
rs( "g_sn ") =   sn
rs( "g_brand ") =   bd
rs( "g_floor ") =   tp
rs( "g_amount ") =   nb
rs( "g_url ") =   nk
rs( "g_time ") =   tm
rs( "g_new_prise ") =   np
rs( "g_old_prise ") =   op
rs( "g_top ")   =   top
rs( "g_fl_su ")   =   g_fl_su
rs( "g_picpath ")   =   g_picpath
'rs.update
rs.close
set   rs=nothing
cnoff
%> <script   language= "javascript "> <!--
window.open( 'list.asp ', 'framain ');
//--> </script>
发表于:2007-08-21 10:42:081楼 得分:0
具体哪个位置出的问题?
发表于:2007-08-21 10:43:062楼 得分:0
upload_5xsoft.inc   这个页面的11行贴出来
发表于:2007-08-21 10:47:153楼 得分:0
应该是化境那出的错误!上传图片那
发表于:2007-08-21 10:49:054楼 得分:0
<script   runat=server   language=vbscript>

' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
'
'请保留此信息:   稻香老农制作   http://www.5xsoft.com/    
'
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

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
version= "化境编程界http上传程序   version   1.0 "
if   request.totalbytes <1   then   exit   sub
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)
idivlen=instring(1,vbenter)+1
strdiv=substring(1,idivlen)
iformstart=idivlen
iformend=instring(iformstart,strdiv)-1
while   iformstart   <   iformend
    istart=instring(iformstart, "name= " " ")
    iend=instring(istart+6, " " " ")
    mformname=substring(istart+6,iend-istart-6)
    ifilenamestart=instring(iend+1, "filename= " " ")
    if   ifilenamestart> 0   and   ifilenamestart <iformend   then
      ifilenameend=instring(ifilenamestart+10, " " " ")
      mfilename=substring(ifilenamestart+10,ifilenameend-ifilenamestart-10)
      istart=instring(ifilenameend+1,vbenter&vbenter)
      iend=instring(istart+4,vbenter&strdiv)
      if   iend> istart   then
        mfilesize=iend-istart-4
      else
        mfilesize=0
      end   if
      set   thefile=new   fileinfo
      thefile.filename=getfilename(mfilename)
      thefile.filepath=getfilepath(mfilename)
      thefile.filesize=mfilesize
      thefile.filestart=istart+4
      thefile.formname=formname
      file.add   mformname,thefile
    else
      istart=instring(iend+1,vbenter&vbenter)
      iend=instring(istart+4,vbenter&strdiv)

      if   iend> istart   then
        mformvalue=substring(istart+4,iend-istart-4)
      else
        mformvalue= " "  
      end   if
      form.add   mformname,mformvalue
    end   if

    iformstart=iformend+idivlen
    iformend=instring(iformstart,strdiv)-1
wend
end   sub

private   function   substring(thestart,thelen)
  dim   i,c,stemp
  upfile_5xsoft_stream.position=thestart-1
  stemp= " "
  for   i=1   to   thelen
      if   upfile_5xsoft_stream.eos   then   exit   for
      c=ascb(upfile_5xsoft_stream.read(1))
      if   c   >   127   then
        if   upfile_5xsoft_stream.eos   then   exit   for
        stemp=stemp&chr(ascw(chrb(ascb(upfile_5xsoft_stream.read(1)))&chrb(c)))
        i=i+1
      else
        stemp=stemp&chr(c)
      end   if
  next
  substring=stemp
end   function

private   function   instring(thestart,varstr)
  dim   i,j,bt,thelen,str
  instring=0
  str=tobyte(varstr)
  thelen=lenb(str)
  for   i=thestart   to   upfile_5xsoft_stream.size-thelen
      if   i> upfile_5xsoft_stream.size   then   exit   function
      upfile_5xsoft_stream.position=i-1
      if   ascb(upfile_5xsoft_stream.read(1))=ascb(midb(str,1))   then
        instring=i
        for   j=2   to   thelen
            if   upfile_5xsoft_stream.eos   then  
                instring=0
                exit   for
            end   if
            if   ascb(upfile_5xsoft_stream.read(1)) <> ascb(midb(str,j,1))   then
                instring=0
                exit   for
            end   if
        next
        if   instring <> 0   then   exit   function
      end   if
  next
end   function

private   sub   class_terminate    
    form.removeall
    file.removeall
    set   form=nothing
    set   file=nothing
    upfile_5xsoft_stream.close
    set   upfile_5xsoft_stream=nothing
end   sub
     
 
  private   function   getfilepath(fullpath)
    if   fullpath   <>   " "   then
      getfilepath   =   left(fullpath,instrrev(fullpath,   "\ "))
    else
      getfilepath   =   " "
    end   if
  end     function
 
  private   function   getfilename(fullpath)
    if   fullpath   <>   " "   then
      getfilename   =   mid(fullpath,instrrev(fullpath,   "\ ")+1)
    else
      getfilename   =   " "
    end   if
  end     function

  private   function   tobyte(str)
      dim   i,icode,c,ilow,ihigh
      tobyte= " "
      for   i=1   to   len(str)
      c=mid(str,i,1)
      icode   =asc(c)
      if   icode <0   then   icode   =   icode   +   65535
      if   icode> 255   then
          ilow   =   left(hex(asc(c)),2)
          ihigh   =right(hex(asc(c)),2)
          tobyte   =   tobyte   &   chrb( "&h "&ilow)   &   chrb( "&h "&ihigh)
      else
          tobyte   =   tobyte   &   chrb(ascb(c))
      end   if
      next
  end   function
end   class


class   fileinfo
    dim   formname,filename,filepath,filesize,filestart
    private   sub   class_initialize  
        filename   =   " "
        filepath   =   " "
        filesize   =   0
        filestart=   0
        formname   =   " "
    end   sub
   
  public   function   saveas(fullpath)
        dim   dr,errorchar,i
        saveas=1
        if   trim(fullpath)= " "   or   filesize=0   or   filestart=0   or   filename= " "   then   exit   function
        if   filestart=0   or   right(fullpath,1)= "/ "   then   exit   function
        set   dr=createobject( "adodb.stream ")
        dr.mode=3
        dr.type=1
        dr.open
        upfile_5xsoft_stream.position=filestart-1
        upfile_5xsoft_stream.copyto   dr,filesize
        dr.savetofile   fullpath,2
        dr.close
        set   dr=nothing  
        saveas=0
    end   function
end   class
</script>
发表于:2007-08-21 10:49:285楼 得分:0
这是我用的inc
发表于:2007-08-21 10:50:286楼 得分:0
既然允许上传东西,那么你的fso服务开了没有?
发表于:2007-08-21 10:51:027楼 得分:0
set   file=upload.file( "pic ")     ' '生成一个文件对象
好像这句不能执行……
发表于:2007-08-21 10:52:038楼 得分:0
我其他的东西都能上传啊……就是这个图片不能!我的会员数据就能上传!
发表于:2007-08-21 10:56:549楼 得分:0
你会员数据都传哪里去了?图片估计不是往数据表里放的吧,而是在服务器上建立一个目录,然后放到目录下的,数据表只是存放了一个地址而已吧?
发表于:2007-08-21 10:57:5310楼 得分:0
是不是图片太大了
发表于:2007-08-21 11:05:2311楼 得分:0
是个地址啊!那你说咋办啊?图片不大啊!只有几k
发表于:2007-08-21 11:21:0512楼 得分:0
你是想让这个图片传到服务器上面,然后数据表中存个地址对不?
那你就在服务器上面做以下操作

开始菜单--> 运行,输入services.msc,然后去找filesystemobject这一项,并把这项的启动类型设置成自动,然后点击服务状态中的启动,启动该服务.

随后找到上传的目录,将其的目录权限的写入勾上,然后再试.
发表于:2007-08-21 11:21:4413楼 得分:0
不过开fso服务有相当大的风险.
发表于:2007-08-21 11:22:3414楼 得分:0
如果找不到fso服务的话就去这里看

http://hi.baidu.com/8736/blog/item/3b8ce0cdb7fe90530fb3458b.html
发表于:2007-08-21 11:31:5515楼 得分:0
我   作的是在后台管理上添加商品信息和图片!然后添加后在前台页面显示了!


快速检索

最新资讯
热门点击