开发者

VBScript - image to binary

开发者 https://www.devze.com 2022-12-08 10:04 出处:网络
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

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 ima开发者_运维问答ge 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!


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


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
...
0

精彩评论

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