Please help me! VBScript runtime error '800a000d'

Discussion in 'C#' started by teli1013, Feb 17, 2009.

  1. #1
    Hello everyone,

    When I upload product picture, I get the error massage:

    Microsoft VBScript runtime error '800a000d'

    Type mismatch: '[string: "2/17/200924253"]'

    /01/admin/Upload.asp, line 49


    This error I get when I run it at USA server, but I run it at Chinese server, it's no problem, work well, I don't why. follow is the Upload.asp code:

    --------------------------------------------------------------------
    <!--#include file="conn.asp"-->
    <!--#include file="inc/upload.inc"-->
    <script type="text/javascript" src="inc/common.js"></script>
    <html>
    <head>
    <title>Pic upload</title>
    <style>
    td{font-size:9pt;line-height:140%}
    body{font-size:9pt;line-height:140%}
    a:link { color: #0033CC; text-decoration: none }
    a:visited { color: #0033CC; text-decoration: none }
    a:hover { color: #000000; text-decoration: underline}
    </style>
    </head>
    <body topmargin="5" leftmargin="5">
    <%
    dim upload,file,formName,formPath,iCount,uptype,txtname
    set upload=new upload_5xSoft
    uptype=upload.form("upid")
    ExtName = "jpg,gif,swf"
    if upload.form("filepath")="" then
    HtmEnd
    set upload=nothing
    response.end
    else
    formPath=upload.form("filepath")
    txtname=upload.form("txtname")

    if right(formPath,1)<>"/" then formPath=formPath&"/"
    end if

    iCount=0
    for each formName in upload.file
    set file=upload.file(formName)
    if file.FileSize>0 then
    if instr(ExtName,GetExtendName(file.FileName))=0 then
    Response.write "<script>alert('Wrong file type!');window.close();</script>"
    Response.End
    end if
    dim fname
    fname = now()
    fname = replace(fname,"-","")
    fname = replace(fname," ","")
    fname = replace(fname,":","")
    fname = replace(fname,"PM","")
    fname = replace(fname,"AM","")
    fname = replace(fname,"AM","")
    fname = replace(fname,"PM","")
    fname = int(fname) + int((10-1+1)*Rnd + 1) ------------Line 49
    fname=""&fname&"."&GetExtendName(file.FileName)&""
    file.SaveAs Server.mappath(formPath&fname)
    tmp = "http://" & request.servervariables("SERVER_NAME") & _
    left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("upload.asp"))
    picurl=fname
    picurl = replace(picurl,"..","")
    end if
    set file=nothing
    next
    set upload=nothing
    'Htmend iCount&"
    sub HtmEnd(Msg)
    set upload=nothing
    end sub

    function GetExtendName(FileName)
    dim ExtName
    ExtName = LCase(FileName)
    ExtName = right(ExtName,3)
    ExtName = right(ExtName,3-Instr(ExtName,"."))
    GetExtendName = ExtName
    end function
    if picurl<>"" then%>
    <%if uptype="1" then%>
    <script>window.opener.document.form1.<%=txtname%>.value='pro/upload/<%=picurl%>';alert('upload ok!');window.close();</script>
    <%elseif uptype="2" then%>
    <script>window.opener.document.form1.<%=txtname%>.value='upload/<%=picurl%>';alert('upload ok!');window.close();</script>
    <%elseif uptype="3" then%>
    <script>window.opener.document.form1.<%=txtname%>.value='img/upload/<%=picurl%>';alert('upload ok!');window.close();</script>
    <%end if%>
    <%else%>
    select your pic to upload [<a href="Javascript:history.go(-1)">upload again</a>]
    <%end if%>
    </body>
    </html>

    --------------------------------------------------------------------

    Sorry for my poor english, this very urgent! pls give me a help.
    Thanks.
     
    teli1013, Feb 17, 2009 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    i'm not sure if this is what your trying to do but add:
    
    fname = replace(fname,"/","")
    
    Code (markup):
    before line 49 amongst your other 'replace' lines
     
    camjohnson95, Feb 18, 2009 IP
  3. alexpr07

    alexpr07 Active Member

    Messages:
    284
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #3
    I agree with the post above. That's the cause of your problem. And why you have AM and PM replaces twice?
     
    alexpr07, Feb 26, 2009 IP