By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Insert or update an image in blob field

P: 8
Expand|Select|Wrap|Line Numbers
  1. If Request.TotalBytes > 0 Then
  2. req_bytes = Request.BinaryRead(tot_bytes)
  3.  'Parse POSTed request JSON
  4.  reqArgsString = BytesToStr(req_bytes)
  5.  reqArgsArray = Split(reqArgsString, "&")
  6.  For i = 0 To UBound(reqArgsArray)
  7.     reqArgsArray(i) = Split(reqArgsArray(i), "=")
  8.  Next
  9. 'Decode base64 image from JSON POST to BytesArray'
  10.  base64Encoded = URLDecode(reqArgsArray(1)(1))
  11.  base64Decoded = decodeBase64(base64Encoded)
  12.  'Response.Write base64Decoded
  13.  '' GoTo Done
  14.   'DB Connection Object
  15.  'Set cn = Server.CreateObject("ADODB.Connection")
  16.  'ConnStr="DRIVER=SQL Server;SERVER=161.196.101.140;UID=sa;PWD=P@ssw0rdsql;Database=ContinuumDB"
  17.  'cn.Open ConnStr
  18.  'Dim strQry 
  19.  'strQry = "INSERT INTO GA_BLOB (""Blob_Segment"", ""Blob_Person_ID"") VALUES (?, ?)"
  20.  'Dim cm As ADODB.Command
  21.  'Set cm = New ADODB.Command
  22.  'cm.ActiveConnection = cn
  23.  'cm.CommandText = strQry
  24.  'cm.Parameters.Append cm.CreateParameter("@Blob_Segment", adVarBinary, adParamInput, 100, base64Decoded) 'Leave this parameter first
  25.  'cm.Parameters.Append cm.CreateParameter("@Blob_Person_ID", adInteger, adParamInput, , reqArgsArray(1)(1))
  26.  'cm.CommandType = adCmdText
  27.  'cm.Execute
Apr 20 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.