asp中的图像解码

时间:2011-02-08 06:39:09

标签: java asp-classic encoder decoder

HI可以通过图像

告诉我如何解码java编码的asp经典中的base64字符串

1 个答案:

答案 0 :(得分:0)

将base64字符串传递给decodeBase64()函数,如下所示,并将文件名和返回值传递给writeBytes过程,图像将在文件系统上创建

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