相思资源网 Design By www.200059.com
<%
'先下载远程图片
url=\"http://www.im286.com/image... '远程图片地址
savepath=\"D:\photo\\" '保存路径
'为文件重命名
randomize
ranNum=int(999*rnd)
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
'为文件重命名结束
set xmlhttp=server.createobject(\"Microsoft.XMLHTTP\")
xmlhttp.open \"get\",url,false
xmlhttp.send
img = xmlhttp.ResponseBody
set xmlhttp=nothing
set objAdostream=server.createobject(\"ADODB.Stream\")
objAdostream.Open()
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(savepath&filename&\".jpg\")
objAdostream.SetEOS
set objAdostream=nothing
'文件下载结束
Set Upload = Server.CreateObject(\"Persits.Upload\") '打开对象
Set File = Upload.OpenFile(savepath&filename&\".jpg\") '打开已经保存的文件
If File.ImageType <> \"JPG\" and File.ImageType <> \"GIF\" and File.ImageType <> \"BMP\" and File.ImageType <> \"PNG\" Then
Upload.DeleteFile savepath&filename&\".jpg\" '如果格式不正确就删除这张已下载的图片
response.write \"错误的图片格式\"
end if
'注销实例
Set Upload = nothing
Set File = nothing
%>
'先下载远程图片
url=\"http://www.im286.com/image... '远程图片地址
savepath=\"D:\photo\\" '保存路径
'为文件重命名
randomize
ranNum=int(999*rnd)
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
'为文件重命名结束
set xmlhttp=server.createobject(\"Microsoft.XMLHTTP\")
xmlhttp.open \"get\",url,false
xmlhttp.send
img = xmlhttp.ResponseBody
set xmlhttp=nothing
set objAdostream=server.createobject(\"ADODB.Stream\")
objAdostream.Open()
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(savepath&filename&\".jpg\")
objAdostream.SetEOS
set objAdostream=nothing
'文件下载结束
Set Upload = Server.CreateObject(\"Persits.Upload\") '打开对象
Set File = Upload.OpenFile(savepath&filename&\".jpg\") '打开已经保存的文件
If File.ImageType <> \"JPG\" and File.ImageType <> \"GIF\" and File.ImageType <> \"BMP\" and File.ImageType <> \"PNG\" Then
Upload.DeleteFile savepath&filename&\".jpg\" '如果格式不正确就删除这张已下载的图片
response.write \"错误的图片格式\"
end if
'注销实例
Set Upload = nothing
Set File = nothing
%>
标签:
ASP远程保存图片
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无ASP远程保存图片的评论...