Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    1

    Unanswered: Can Anyone Help me?

    Microsoft VBScript runtime (0x800A0005)
    Invalid procedure call or argument
    /ase/csspss_editE.asp, line 230
    ************************************************** *********
    Dim UploadRequest,RequestBin,dte, time, CompanyName,ContactName,CompanyAddress,Position,Ca tegory,Tel,map
    Set UploadRequest = CreateObject("Scripting.Dictionary")
    filepath=Server.MapPath("images/map")
    byteCount = Request.TotalBytes
    RequestBin = Request.BinaryRead(byteCount)
    BuildUploadRequest RequestBin
    dte = UploadRequest.Item("dte").Item("Value")
    eTime = UploadRequest.Item("tim").Item("Value")
    CompanyName = UploadRequest.Item("CompanyName").Item("Value")
    ContactName = UploadRequest.Item("ContactName").Item("Value")
    Position = UploadRequest.Item("Position").Item("Value")
    Category = UploadRequest.Item("cat").Item("Value")
    CompanyAddress = UploadRequest.Item("CompanyAddress").Item("Value")
    Tel = UploadRequest.Item("Tel").Item("Value")
    filepathname = UploadRequest.Item("map").Item("FileName")
    map = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
    mapvalue = UploadRequest.Item("map").Item("Value")

    Sub uploadimage(imgvalue,imgname)
    if lenB(imgvalue) = 0 then
    response.write "<b>Can not Upload " & "&auml;&Aacute;&egrave;&Aacute;&Otilde;&auml;&ique st;&Aring;&igrave;&sup1;&Otilde;&eacute; / &auml;&iquest;&Aring;&igrave;&Aacute;&Otilde;&cent ;&sup1;&Ograve;&acute;&agrave;&raquo;&ccedil;&sup1 ;&Egrave;&Ugrave;&sup1;&Acirc;&igrave; &curren;&Aring;&Ocirc;&iexcl; Back </b>"
    response.end
    end if
    limitSize = 1024 * 1024
    if lenB(imgvalue) > limitSize then
    response.write "<b>File &atilde;&Euml;­&egrave;&agrave;&iexcl;&Ocirc;&sup1 ; " & FormatNumber(limitSize / 1024) & " KB &curren;&Aring;&Ocirc;&iexcl; Back &iexcl;&Aring;&Ntilde;&ordm;&auml;&raquo;&agrave;& Aring;&times;&Iacute;&iexcl;&atilde;&Euml;&Aacute; &egrave;"
    response.end
    end if

    Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
    Set fileObj = ScriptObject.CreateTextFile(filepath & "/" & imgname)
    For i = 1 to LenB(imgvalue)
    fileObj.Write chr(AscB(MidB(imgvalue,i,1))) >>>>LINE230
    Next
    fileObj.Close
    End Sub
    Call uploadimage(mapvalue,map)

    ErrMsg = ""
    if Request.Form("dteDisplay") = "" then ErrMsg = "กรุณาใสวันที่<br>"
    if Request.Form("Tim") = "" then ErrMsg=ErrMsg & "กรุณาใส่เวลา<br>"
    if Request.Form("CompanyName") = "" then ErrMsg=ErrMsg & "กรุณาใส่ชื่อบริษัท <br>"
    if Request.Form("Contactname") = "" then ErrMsg=ErrMsg & "กรุณาใส่ชื่อของผู้ติดต่อ<br>"
    if Request.Form("Position") = "" then ErrMsg=ErrMsg & "กรุณาใส่ตำแหน่งงานของผู้ติดต่อ <br>"
    if Request.Form("CompanyAddress") = "" then ErrMsg=ErrMsg & "กรุณาใส่ที่อยู่ <br>"
    if Request.Form("Tel") = "" then ErrMsg=ErrMsg & "กรุณาใส่เบอร์โทรศัพท์ <br>"
    if Request.Form("map") = "" then ErrMsg=ErrMsg & "กรุณาใส่รูปแผ่นที่<br>"

    if len(ErrMsg) > 0 then
    Response.Write "<tr><td><div class=heading2>There were problems with your edits:<br></div>"
    Response.Write "<div class=heading3>" & ErrMsg & "</div>"
    Response.Write "<table border='0' cellSpacing=4 align=right valign=top style='margin-right:-4;'"
    Response.Write "<tr height=22><a href='javascript:history.go(-1)'><td id='MyButton' width=60 class=btn>Back</td></a>"
    Response.Write "</tr></table></td></tr>"
    Else
    rs.Open "Csspss", my_conn, 2, 3
    rs.AddNew
    rs("dte") = Request.Form("dte")
    rs("eTime") = Request.Form("tim")
    rs("CompanyName") = Request.Form("CompanyName")
    rs("ContactName") = Request.Form("ContactName")
    rs("Position") = Request.Form("Position")
    rs("Category") = Request.Form("cat")
    rs("CompanyAddress") = Request.Form("CompanyAddress")
    rs("Tel") = Request.Form("Tel")
    rs("map") = Request.Form("map")
    rs.Update
    Response.Write "<div class=heading3>Added Customer</div>"
    End If

    Sub BuildUploadRequest(RequestBin)
    PosBeg = 1
    PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
    boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
    boundaryPos = InstrB(1,RequestBin,boundary)
    Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
    Dim UploadControl
    Set UploadControl = CreateObject("Scripting.Dictionary")
    Pos = InstrB(BoundaryPos,RequestBin,getByteString("Conte nt-Disposition"))
    Pos = InstrB(Pos,RequestBin,getByteString("name="))
    PosBeg = Pos+6
    PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
    Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
    PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filen ame="))
    PosBound = InstrB(PosEnd,RequestBin,boundary)
    If PosFile<>0 AND (PosFile<PosBound) Then
    PosBeg = PosFile + 10
    PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
    FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
    UploadControl.Add "FileName", FileName
    Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
    PosBeg = Pos+14
    PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
    ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
    UploadControl.Add "ContentType",ContentType
    PosBeg = PosEnd+4
    PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
    Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
    Else
    Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
    PosBeg = Pos+4
    PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
    Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
    End If
    UploadControl.Add "Value" , Value
    UploadRequest.Add name, UploadControl
    BoundaryPos=InstrB(BoundaryPos+LenB(boundary),Requ estBin,boundary)
    Loop

    End Sub

    Function getByteString(StringStr)
    For i = 1 to Len(StringStr)
    char = Mid(StringStr,i,1)
    getByteString = getByteString & chrB(AscB(char))
    Next
    End Function

    Function getString(StringBin)
    getString =""
    For intCount = 1 to LenB(StringBin)
    getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
    Next
    End Function
    ************************************************** ********
    what's wrong at LINE230?

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I suspect your problem is in your MidB call. Check the value of i.

    If that bit all seems right split this line out into a series of lines (just for debugging) so you can determine exactly what function is failing.

  3. #3
    Join Date
    Dec 2003
    Posts
    454
    The syntax is object.Write(string).

    I'm not sure if you can use object.Write chr(Byte). Can you tell us what do you want to do with fileObj.Write chr(AscB(MidB(imgvalue,i,1)))?

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    fileObj.Write chr(AscB(MidB(imgvalue,i,1)))?

    what he is doing with the above line is grabbing a single byte, getting the AscII code for it then converting that code to a character using the chr function.

    I don't know if that is a legit use of the functions but in theory that is what is trying to be done (I think).

  5. #5
    Join Date
    Dec 2003
    Posts
    454
    Why don't you use

    fileObj.Write imgvalue

    instead of

    For i = 1 to LenB(imgvalue)
    fileObj.Write chr(AscB(MidB(imgvalue,i,1)))
    Next

    ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •