views:

243

answers:

2

Hi to all,

i'm not a VB programmer but i need a vbscript that convert image file (from local disk) to be converted to binary data and the passed to webservice. I realize how to pass data to webservice but i can't find how to convert the image file to binary data. I spend a lot of time to find some kind of solution but with no luck. Can somebody help me?

Thanks!

A: 

Base64 encode VBS function (vb encoder algorithm), source code http://www.motobit.com/tips/detpg_Base64Encode/

Robert Harvey
A: 

If you simply need to read the image file as binary data (in a way similar to reading text files), you can use the ADODB.Stream object:

Const adTypeBinary = 1
Dim oStream, bData

Set oStream = CreateObject("ADODB.Stream")
oStream.Type = adTypeBinary
oStream.Open
oStream.LoadFromFile "C:\MyImage.png"

bData = oStream.Read

' Do whatever you need with bData
...
Helen