CBA

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

2019-09-13 20:39:34来源:励志吧0次阅读

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.responseBody)

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

查看本文来源

哪些食物是治疗便秘的
糖尿病胃轻瘫消化不好的危害
晚上夜尿多怎么治
小儿呕吐吐奶溢乳有什么区别
分享到: