开发者

image decoding in asp

开发者 https://www.devze.com 2023-02-08 23:41 出处:网络
HI can any body tell me how to decode a base64 strin开发者_Go百科g in asp classic encoded by java from an imagePass the base64 string into decodeBase64() function, as below and pass file name and retu

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
0

精彩评论

暂无评论...
验证码 换一张
取 消