作家
登录

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

作者: 来源:www.28hudong.com 2013-03-30 09:07:39 阅读 我要评论

远程图片自动按文件夹上传到服务器-默飞出品 a { text-decoration: none; color: blue } a:hover { text-decoration: underline } body { scrollbar-base-color: #F8F8F8; scrollbar-arrow-color: #698CC3; font-size: 12pt; background-color: #ffffff } 在输入框中输入远程图片地址,如图片不存在,程序自动放弃本次操作. 制作:默飞 QQ:33224360 演示:http://mofei.xinxiu.com http://www.dns.com.cn域名65元,空间联系默飞可以享受八折优惠,信赖默飞冲天...." else filepath02=mofeifoldfso(savepath) savepath=savepath&""&year(now())&month(now()) filepath02=mofeifoldfso(savepath) urname01=myreplace(imgpath) end if 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没找到内容![返回]" response.end end if objAdostream.SaveToFile(server.mappath(savepath&""&filename)) objAdostream.SetEOS set objAdostream=nothing imgpath01=savepath&""&filename '返回图片路径 imgpath01=replace(imgpath01,"","/") response.write ("图片上传成功! [继续上传]") response.write (" http://www.dns.com.cn域名65元,空间联系默飞可以享受八折优惠,信赖默飞冲天....") 'ad response.write (" ") '根据你的系统需要,更改返回方式. 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 全选 注:如需引入外部Js需刷新才能执行]

  推荐阅读

  分页代码

分页代码: <%''本程序文件名为:Pages.asp%> <%''包含ADO常量表文件adovbs.inc,可从"Program FilesCommon FilesSystemADO"目录下拷贝%> <!--#Include File="adovbs.inc"--> <%''*建立数据库连接,这里是O>>>详细阅读


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

地址:http://www.17bianji.com/kaifa2/ASP/33319.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)