http=new ActiveXObject("msxml2.xmlhttp");
// xmlHttp=new ActiveXObject
var url = 'D:\hg.jpg';
// encodeURI(encodeURI(url));
http.open("get",url,false);
http.send();
//这里得到了图片的二进制内容
var Contents=http.responseBody;
//以下代码,打开 xxx.bmp 可以看到一张图片
// var oStr = new ActiveXObject("ADODB.Stream");
// oStr.Mode = 3;
// oStr.Type = 1;
// oStr.Open();
// oStr.Write(Contents);
// xmlHttp=new ActiveXObject
var url = 'D:\hg.jpg';
// encodeURI(encodeURI(url));
http.open("get",url,false);
http.send();
//这里得到了图片的二进制内容
var Contents=http.responseBody;
//以下代码,打开 xxx.bmp 可以看到一张图片
// var oStr = new ActiveXObject("ADODB.Stream");
// oStr.Mode = 3;
// oStr.Type = 1;
// oStr.Open();
// oStr.Write(Contents);
// oStr.SaveToFile("d:\\12345.jpg", 2);
---------------------------------
function readBinary(fileName)
{
var stream = new ActiveXObject("ADODB.Stream");
stream.Type = 1; // 1=adTypeBinary
stream.Open();
stream.LoadFromFile(fileName);
var content = stream.Read(-1); // -1=adReadAll
stream.Close();
return content;
}