当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp图片采集并且本地重命名保存的函数

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

ASP 中的 asp图片采集并且本地重命名保存的函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 121 ::
收藏到网摘: n/a

图片采集程序,将一个图片保存到本机上,并重新命名。

 


<%
'================================================
'作  用:保存远程的文件到本地
'参  数:LocalFileName ------ 本地文件名
'  RemoteFileUrl ------ 远程文件URL
'返回值:True  ----成功
'       False ----失败
'================================================
Sub SaveRemoteFile(s_LocalFileName,s_RemoteFileUrl)
 Dim Ads, Retrieval, GetRemoteData
 On Error Resume Next
 Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
 With Retrieval
  .Open "Get", s_RemoteFileUrl, False, "", ""
  .Send
  GetRemoteData = .ResponseBody
 End With
 Set Retrieval = Nothing
 Set Ads = Server.CreateObject("Adodb.Stream")
 With Ads
  .Type = 1
  .Open
  .Write GetRemoteData
  .SaveToFile Server.MapPath(s_LocalFileName), 2
  .Cancel()
  .Close()
 End With
 Set Ads=nothing
End Sub
%>


<%
path="./pic/1.gif"
Call SaveRemoteFile(path,"http://image2.sina.com.cn/ent/v/m/2006-05-18/66cb006f0a8411644ac3da5b76c88c77.gif")
response.write "保存成功"
%>