HI can any body tell me how to decode a base64 strin开发者_Go百科g in asp classic encoded by java from an image
Pass the base64 string into decodeBase64() function, as below and pass file name and returned value into writeBytes procedure, image will create on the file system
private function decodeBase64(base64) dim DM, EL Set DM = CreateObject("Microsoft.XMLDOM") ' Create temporary node with Base64 data type Set EL = DM.createElement("tmp") EL.DataType = "bin.base64" ' Set encoded String, get bytes EL.Text = base64 decodeBase64 = EL.NodeTypedValue end function private Sub writeBytes(file, bytes) Dim binaryStream Const TypeBinary = 1, ForWriting = 2 Set binaryStream = CreateObject("ADODB.Stream") binaryStream.Type = TypeBinary 'Open the stream and write binary data binaryStream.Open binaryStream.Write bytes 'Save binary data to disk binaryStream.SaveToFile file, ForWriting End Sub
精彩评论