您的位置:首页 > 编程语言 > ASP

ASPX保存远程图片到本地的两种方法的函数

2006-08-14 16:39 543 查看
aspx保存远程图片到本地的两种方法的函数
function upremotefiletolocal(byval uptype as string, byval remoteurl as string, byval localfile as string) as boolean

dim tmpresult as boolean = false

select case uptype

case "xmlhttp"

'with msxml2

dim myxmlhttp as new msxml2.xmlhttp40

myxmlhttp.open("get", remoteurl, false)

myxmlhttp.send()

dim fs as filestream = new filestream(localfile, filemode.createnew)

dim bw as binarywriter = new binarywriter(fs)

bw.write(myxmlhttp.resp

bw.close()

fs.close()

tmpresult = true

case "webclient"

'with system.net namespace

dim mywebclient as new webclient

mywebclient.downloadfile(remoteurl, localfile)

tmpresult = true

end select

end function
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: