源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

远程图片自动按文件夹上传到服务器-默飞出品

  • 时间:2020-01-25 23:42 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:远程图片自动按文件夹上传到服务器-默飞出品
function myreplace(str) newstr=str set objregEx = new RegExp objregEx.IgnoreCase = true objregEx.Global = true objregEx.Pattern = "http://(.+?)\.(jpg|gif|png|bmp)" '定义文件后缀,可以增加你需要的后缀,按规律增加. set matches = objregEx.execute(str) for each match in matches newstr=replace(newstr,match.value,saveimg(match.value)) next myreplace=newstr end function function saveimg(url) temp=split(url,".") filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&"."&temp(ubound(temp)) '文件名重命名结束 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) if objAdostream.size<200 then response.write "没找到内容![[url=http://www.1sucai.cn/article/38.htm#]返回[/url]]" response.end end if objAdostream.SaveToFile(server.mappath(savepath&"\"&filename)) objAdostream.SetEOS set objAdostream=nothing imgpath01=savepath&"\"&filename '返回图片路径 imgpath01=replace(imgpath01,"\","/") response.write ("图片上传成功! [[url=http://www.1sucai.cn/article/38.htm#]继续上传[/url]]") response.write (" [url=http://www.dns.com.cn]http://www.dns.com.cn[/url][b]域名65元,空间联系默飞可以享受八折优惠,信赖[url=http://mofei.xinxiu.com]默飞冲天[/url]....[/b]") 'ad response.write (" [img]http://www.1sucai.cn/article/&imgpath01&[/img] ") '根据你的系统需要,更改返回方式. end function Function mofeifoldfso(mpath) Set fso = Server.CreateObject("Scripting.FileSystemObject") if not fso.FolderExists(server.Mappath(mpath)) then fso.Createfolder(server.mappath(mpath)) set fso=nothing End Function %> [Ctrl+A 全选 注:[url=http://www.1sucai.cn/article/23421.htm]如需引入外部Js需刷新才能执行[/url]]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部