一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp 复制文件与保存远程服务器文件

时间:2009-07-11 编辑:简简单单 来源:一聚教程网


 '==============================
 '函 数 名: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

热门栏目