HI can any body tell me how to decode a base64 string in asp classic encoded by java from an image
Asked
Active
Viewed 310 times
0
-
1why this question is tagged with `JAVA`? – Harry Joy Feb 08 '11 at 06:41
-
because the string is decoded by java so may be any java person may also help – agarwal_achhnera Jun 18 '11 at 09:04
-
1@user571616 In the text you say it's encoded by Java; which is it? In any case, when I search Google there's a *lot* of results--perhaps if you tried implementing one of those and asked a more-specific question? – Dave Newton Nov 15 '11 at 23:03
-
possible duplicate of [base64 image decoder for ASP classic](http://stackoverflow.com/questions/4920416/base64-image-decoder-for-asp-classic) – Simone Carletti Nov 17 '11 at 09:24
1 Answers
0
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

agarwal_achhnera
- 2,582
- 9
- 55
- 84