0514-86177077
9:00-17:00(工作日)
遠程圖片自動按文件夾上傳到服務(wù)器-默飛出品<%'遠程圖片自動按文件夾上傳到服務(wù)器'制作:默飛Server.ScriptTimeOut=99999savepath="upfiles" '圖片保存路徑,可以根據(jù)自己的需要,進行修改,如沒有創(chuàng)建此文件夾,系統(tǒng)將自動創(chuàng)建'QQ:33224360'HOME:http://mofei.xinxiu.com'EMAIL:mofei5@yahoo.com.cn'2005-10-15'版權(quán)說明不影響資源,請保留版權(quán)信息imgpath=request("imgpath")if imgpath="" thenresponse.write " 在輸入框中輸入遠程圖片地址,如圖片不存在,程序自動放棄本次操作.制作:默飛QQ:33224360演示:http://mofei.xinxiu.comhttp://www.dns.com.cn域名65元,空間聯(lián)系默飛可以享受八折優(yōu)惠,信賴默飛沖天...."elsefilepath02=mofeifoldfso(savepath)savepath=savepath"\"year(now())month(now())filepath02=mofeifoldfso(savepath)urname01=myreplace(imgpath)end if function myreplace(str)newstr=strset objregEx = new RegExpobjregEx.IgnoreCase = trueobjregEx.Global = trueobjregEx.Pattern = "http://(.+?)\.(jpg|gif|png|bmp)" '定義文件后綴,可以增加你需要的后綴,按規(guī)律增加.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))'文件名重命名結(jié)束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 "沒找到內(nèi)容![返回]"response.endend ifobjAdostream.SaveToFile(server.mappath(savepath"\"filename))objAdostream.SetEOSset objAdostream=nothingimgpath01=savepath"\"filename '返回圖片路徑imgpath01=replace(imgpath01,"\","/")response.write ("圖片上傳成功! [繼續(xù)上傳]") response.write ("http://www.dns.com.cn域名65元,空間聯(lián)系默飛可以享受八折優(yōu)惠,信賴默飛沖天....") 'adresponse.write ("") '根據(jù)你的系統(tǒng)需要,更改返回方式.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%> [Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]
function myreplace(str)newstr=strset objregEx = new RegExpobjregEx.IgnoreCase = trueobjregEx.Global = trueobjregEx.Pattern = "http://(.+?)\.(jpg|gif|png|bmp)" '定義文件后綴,可以增加你需要的后綴,按規(guī)律增加.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))'文件名重命名結(jié)束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 "沒找到內(nèi)容![返回]"response.endend ifobjAdostream.SaveToFile(server.mappath(savepath"\"filename))objAdostream.SetEOSset objAdostream=nothingimgpath01=savepath"\"filename '返回圖片路徑imgpath01=replace(imgpath01,"\","/")response.write ("圖片上傳成功! [繼續(xù)上傳]") response.write ("http://www.dns.com.cn域名65元,空間聯(lián)系默飛可以享受八折優(yōu)惠,信賴默飛沖天....") 'adresponse.write ("") '根據(jù)你的系統(tǒng)需要,更改返回方式.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%>
標簽:內(nèi)江 懷化 天津 臺灣 麗江 成都 公主嶺 重慶
上一篇:ASP小偷(遠程數(shù)據(jù)獲取)程序的入門教程
下一篇:純編碼實現(xiàn)Access數(shù)據(jù)庫的建立或壓縮
Copyright ? 1999-2012 誠信 合法 規(guī)范的巨人網(wǎng)絡(luò)通訊始建于2005年
蘇ICP備15040257號-8