if uploaddata.Item("product_id").Item("value")="" or _
uploaddata.Item("product_name").Item("value")="" or _
uploaddata.Item("product_detail").Item("value")="" or _
uploaddata.Item("blob").Item("value")="" or _
uploaddata.Item("select").Item("value")="" or _
uploaddata.Item("product_stock_min").Item("value")="" or _
uploaddata.Item("product_stock_max").Item("value")="" or _
uploaddata.Item("product_stock_advise").Item("value")="" or _
uploaddata.Item("product_guarantee").Item("value")="" then
response.write"<center><input type=button class=input_button3 value='¡ÃÍ¡¢éÍÁÙÅäÁè¤Ãº ¡ÅѺ仡ÃÍ¡¢éÍÁÙÅãËÁè !!' onClick='history.go(-1)' ></center>"
else
filename = uploaddata.item("blob").item("filename") '--ÍéÒ§¶Ö§ª×èͧ͢ ªèͧÃѺÊ觢éÍÁÙÅáÅéǵÒÁ´éÇ ¤èÒ value ËÃ×Í filename(¶éÒËÒ¡¢éÍÁÙÅà»ç¹ªèͧÊè§ÃÙ»ÀÒ¾)--
pos_filebegin = InStrRev(filename,"\")
pos_fileend = Len(filename)
filename_new = Mid(filename,pos_filebegin+1,pos_fileend - pos_filebegin)
set fs = Server.CreateObject("Scripting.FileSystemObject")
set uploadfile = fs.CreateTextFile(Server.MapPath("file/"&filename_new))
uploadfile.write uploaddata.Item("blob").Item("value")
uploadfile.close
filename_new="file\"&filename_new
userid = session("uname")
sql2 = "Select * from product where product_id='"&uploaddata.Item("product_id").Item("value")&"'"
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open sql2, conn, 1,3
if (Rs1.EOF) Then
sql="select * from product"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 1,3
if rs.recordcount <> 0 then
rs.addnew
rs("product_id")=uploaddata.Item("product_id").Item("value")
rs("product_name")=uploaddata.Item("product_name").Item("value")
rs("product_detail")=uploaddata.Item("product_detail").Item("value")
rs("product_pics")=filename_new
rs("product_stock_min")=uploaddata.Item("product_stock_min").Item("value")
rs("product_stock_max")=uploaddata.Item("product_stock_max").Item("value")
rs("product_stock_advise")=uploaddata.Item("product_stock_advise").Item("value")
rs("product_guarantee")=uploaddata.Item("product_guarantee").Item("value")
rs.Update
With Response
.Write "<br><br><table align=center width=400 cellspacing=0 cellpadding=0 bgcolor=#ff6600><tr><td>"
.Write "<table align=center border=0 width='100%' cellpadding=1 cellspacing=1>"
.Write "<tr><td bgcolor=#ffffcc align=center>"
.Write "<b>Status : </b> <IMG SRC=picturs/icon_mini_register.gif >ºÑ¹·Ö¡¢éÍÁÙÅà¢éÒÊÙèÃкºàÃÕºÃéÍÂáÅéÇ "
.Write "</td></tr></table>"
.Write "</td></tr></table>"
End With
rs.close
else
end if
else
With Response
.Write "<br><br><table align=center width=400 cellspacing=0 cellpadding=0 bgcolor=#ff6600><tr><td>"
.Write "<table align=center border=0 width='100%' cellpadding=1 cellspacing=1>"
.Write "<tr><td bgcolor=#ffffcc align=center>"
.Write "<b>Status : </b> ÃËÑʹÕéä´é·Ó¡ÒÃÊÁѤÃáÅéǤÃѺ"
.Write "</td></tr></table>"
.Write "</td></tr></table>"
End With
rs1.close
end if
end if
%>
<%
'-- ¿Ñ§¤ìªÑè¹à»ÅÕè¹ ¢éͤÇÒÁ à»ç¹ ¢éÍÁÙÅ亹ÒÃÕ --
Function TextToBinary(text)
for i = 1 to Len(text)
character = mid(text,i,1)
TextToBinary = TextToBinary & ChrB(Asc(character))
next
End Function
'-- ¿Ñ§¤ìªÑè¹à»ÅÕè¹ ¢éÍÁÙÅ亹ÒÃÕ ¡ÅѺà»ç¹ ¢éͤÇÒÁ --
Function BinaryToText(Binary)
BinaryToText=""
for i =1 to LenB(Binary)
character = MidB(Binary,i,1)
BinaryToText = BinaryToText & Chr(AscB(character))
next
End Function
'-- ¡Ó˹´¡ÒÃãªé Dictionary ·ÓãËéà¡çº¢éÍÁÙÅä´éÁÒ¡¤ÅéÒ¡Ѻ Array --
set uploaddata = CreateObject("Scripting.Dictionary")
data = request.BinaryRead(request.TotalBytes)
posend = InstrB(1,data,TextToBinary(chr(13)))
header = MidB(data,1,posend-1)
'-- ¡ÒÃǹÅÙ»à¾×è͵Ѵ¢éÍÁÙÅ·Õè¶Ù¡Êè§ÁÒãËé¤Ãº·Ñé§ËÁ´ --
Do While pos_header <> pos_endheader
set sub_uploaddata = CreateObject("Scripting.Dictionary")