[ASP]Save remote files to local
Thursday on August 9th, 2007Life
Save remote files to local ASP code.
File:Get.asp'=================================================='Procedure name: SaveRemoteFile'Purpose: Save remote files to local'Parameter: LocalFileName -----Local File Name' RemoteFileUrl -----Remote File URL'==================================================sub SaveRemoteFile(LocalFileName,RemoteFileUrl)dim Ads,Retrieval,GetRemoteDataSet Retrieval = Server.CreateObject("Microsoft.XMLHTTP")With Retrieval.Open "Get", RemoteFileUrl, False, "", "".SendGetRemoteData = .ResponseBodyEnd WithSet Retrieval = NothingSet Ads = Server.CreateObject("Adodb.Stream")With Ads.Type = 1.Open.Write GetRemoteData.SaveToFile server.MapPath("pic/"&LocalFileName),2.Cancel().Close()End WithSet Ads=nothingend sub
Call: SaveRemoteFile "test.gif","/images/logo.gif"
Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/ASP-Save-remote-files-to-local.htm