【www.gdgbn.com--远程及网络应用】


 "==============================
 "函 数 名:CopyFiles
 "作    用:复制文件
 "参    数:文件来源地址SourcePath,文件复制到地址CopyToPath
 "==============================
 Function CopyFiles(SourcePath,CopyToPath)
  Set Fso=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
   Fso.CopyFile Server.MapPath(SourcePath),Server.MapPath(CopyToPath)
   Set Fso=nothing
 End Function
 
 "==============================
 "函 数 名:SaveRemoteFile
 "作    用:保存远程图片
 "参    数:图片来源网址SourceUrl,图片保存地址SavePath
 "==============================
 Sub SaveRemoteFile(SourceUrl,SavePath)
  On Error Resume Next
  Set Temp = Server.CreateObject("Mic"&"roso"&"ft.XML"&"HT"&"TP")
  With Temp
   .Open "Get", SourceUrl, False, "", ""
   .Send
   If Err.number<>0 Then
    Exit Sub
   End If
   F = .ResponseBody
  End With
  Set Temp = Nothing
  Set objAdoStream = Server.CreateObject("A"&"dod"&"b.St"&"r"&"eam")
  With objAdoStream
   .Type = 1
   .Open
   .Write F
   .SaveToFile Server.MapPath(SavePath), 2
   .Cancel()
   .Close()
  End With
  Set objAdoStream=nothing
 End Sub
End Class

本文来源:http://www.gdgbn.com/asp/20753/