首页| 新闻| 娱乐| 游戏| 科普| 文学| 编程| 系统| 数据库| 建站| 学院| 产品| 网管| 维修| 办公| 热点
远程图片自动按文件夹上传到服务器-默飞出品<%'远程图片自动按文件夹上传到服务器'制作:默飞Server.ScriptTimeOut=99999savepath="upfiles" '图片保存路径,可以根据自己的需要,进行修改,如没有创建此文件夹,系统将自动创建'QQ:33224360'HOME:http://mofei.xinxiu.com'EMAIL:mofei5@yahoo.com.cn'2005-10-15'版权说明不影响资源,请保留版权信息imgpath=request("imgpath")if imgpath="" thenresponse.write " 在输入框中输入远程图片地址,如图片不存在,程序自动放弃本次操作.制作:默飞QQ:33224360演示:http://mofei.xinxiu.comhttp://www.dns.com.cn域名65元,空间联系默飞可以享受八折优惠,信赖默飞冲天...."elsefilepath02=mofeifoldfso(savepath)savepath=savepath&"/"&year(now())&month(now())filepath02=mofeifoldfso(savepath)urname01=myreplace(imgpath)end iffunction myreplace(str)newstr=strset objregEx = new RegExpobjregEx.IgnoreCase = trueobjregEx.Global = trueobjregEx.Pattern = "http://(.+?)/.(jpg|gif|png|bmp)" '定义文件后缀,可以增加你需要的后缀,按规律增加.set matches = objregEx.execute(str)for each match in matchesnewstr=replace(newstr,match.value,saveimg(match.value))nextmyreplace=newstrend functionfunction 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,falsexmlhttp.sendimg=xmlhttp.ResponseBodyset xmlhttp=nothingset objAdostream=server.createobject("ADODB.Stream")objAdostream.Open()objAdostream.type=1objAdostream.Write(img)if objAdostream.size<200 thenresponse.write "没找到内容![返回]"response.endend ifobjAdostream.SaveToFile(server.mappath(savepath&"/"&filename))objAdostream.SetEOSset objAdostream=nothingimgpath01=savepath&"/"&filename '返回图片路径imgpath01=replace(imgpath01,"/","/")response.write ("图片上传成功! [继续上传]") response.write ("http://www.dns.com.cn域名65元,空间联系默飞可以享受八折优惠,信赖默飞冲天....") 'adresponse.write ("") '根据你的系统需要,更改返回方式.end functionFunction mofeifoldfso(mpath)Set fso = Server.CreateObject("Scripting.FileSystemObject")if not fso.FolderExists(server.Mappath(mpath)) then fso.Createfolder(server.mappath(mpath))set fso=nothingEnd Function%> [Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]
function myreplace(str)newstr=strset objregEx = new RegExpobjregEx.IgnoreCase = trueobjregEx.Global = trueobjregEx.Pattern = "http://(.+?)/.(jpg|gif|png|bmp)" '定义文件后缀,可以增加你需要的后缀,按规律增加.set matches = objregEx.execute(str)for each match in matchesnewstr=replace(newstr,match.value,saveimg(match.value))nextmyreplace=newstrend 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,falsexmlhttp.sendimg=xmlhttp.ResponseBodyset xmlhttp=nothingset objAdostream=server.createobject("ADODB.Stream")objAdostream.Open()objAdostream.type=1objAdostream.Write(img)if objAdostream.size<200 thenresponse.write "没找到内容![返回]"response.endend ifobjAdostream.SaveToFile(server.mappath(savepath&"/"&filename))objAdostream.SetEOSset objAdostream=nothingimgpath01=savepath&"/"&filename '返回图片路径imgpath01=replace(imgpath01,"/","/")response.write ("图片上传成功! [继续上传]") response.write ("http://www.dns.com.cn域名65元,空间联系默飞可以享受八折优惠,信赖默飞冲天....") 'adresponse.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=nothingEnd Function%>
选择笔记本处理器(CPU)需避免那
如何玩转笔记本视频输出的三种
选择笔记本处理器(CPU)需避免那些误区和基
校园甜美的背影,洋溢着青春烂漫的回忆
芭蕾舞蹈表演,真实美到极致
游览合肥滨湖湿地公园 美不胜收的湿地景
夏日图赏:初夏若雨等花开
肉食主义者的最爱美食烤肉图片
夏日甜心草莓美食图片
人逢知己千杯少,喝酒搞笑图集
搞笑试卷,学生恶搞答题
新闻热点
疑难解答
图片精选
asp编译成dll-图形化教程第1/2页
一份ASP内存的释放的实验报告
ASP编程入门进阶(五):内置对象Respons
ASP编程入门进阶(二十):ADO组件之显示
网友关注