关于ASP如何接收传来的二进制数据流

来源:百度知道 编辑:UC知道 时间:2024/06/01 07:34:04
一个FLASH,提交后,
enctype="application/octet-stream" 用的这个,提交到一个页面,提交的是二进制的数据流,怎么接收这些数据,并保存成JPG的图片呢.

我知道一个JSP的写法,现在急需ASP的写法啊,请高手帮忙\
以下是JSP的
InputStream is = request.getInputStream();
BufferedImage img = ImageIO.read(is);
String uploadPath = application.getRealPath("/upload");
ImageIO.write(img, "jpeg", new File(uploadPath, "fileName.jpg"));

现在急需ASP的写法

谢谢 了

<%
function getHTTPimg(url)
dim http
set http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPimg=Http.responseBody
set http=nothing
end function

function Save2Local(from,tofile)
dim geturl,objStream,imgs
geturl=trim(from)
imgs=gethttpimg(geturl)
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type =1
objStream.Open
objstream.write imgs
objstream.SaveToFile tofile,2
objstream.Close()
set objstream=nothing
end function

call Save2Local("http://www.baidu.com/img/baidu_logo_jr_0905_jy.gif" ,server.MapPath("1.gif"))
%>
参考资料: 自己写的并测试通过,图片地址自己改吧

byteCount = Request.TotalBytes'