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 " & "äÁèÁÕä&ique st;Åì¹Õé / ä¿ÅìÁÕ¢ ;¹Ò´à»ç¹ ;ÈÙ¹Âì ¤ÅÔ¡ Back </b>"
response.end
end if
limitSize = 1024 * 1024
if lenB(imgvalue) > limitSize then
response.write "<b>File ãËèà¡Ô¹ ; " & FormatNumber(limitSize / 1024) & " KB ¤ÅÔ¡ Back ¡ÅѺä»à& Aring;×Í¡ãËÁ è"
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?