Remote images are automatically uploaded to the server by folders-mofei

Source: Internet
Author: User

<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "> <br/> <style type =" text/CSS "> 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 }</style> <p> <input type = "text" name = "imgpath" size = "35"> <input type = "Submit" name = "submit001" value = "Upload"> <br/> Enter the remote image address in the input box. The image does not exist. <SPAN class = 'wp _ keywordlink '> Program </span> automatically abandons this operation. </P> <p> production: Mo Fei <br/> QQ: 33224360 <br/> Demo: http://mofei.xinxiu.com </P> <p> http://www.dns.com.cn <B> domain name 65 yuan, space contact Mo Fei can enjoy a discount and trust Mo Fei chongtian .... </B> "<br/> else <br/> filepath02 = mofeifoldfso (savepath) <br/> savepath = savepath &" \ "& year (now ()) & month (now () <br/> filepath02 = mofeifoldfso (savepath) <br/> urname01 = myreplace (imgpath) <br/> end if </P> <p> function myrepla Ce (STR) <br/> newstr = STR <br/> set objregex = new Regexp <br/> objregex. ignorecase = true <br/> objregex. global = true <br/> objregex. pattern = "http ://(. + ?) \. (JPG | GIF | PNG | BMP) "'defines the file suffix. You can add the suffix you need and add it as needed. <br/> set matches = objregex.exe cute (STR) <br/> for each match in matches <br/> newstr = Replace (newstr, match. value, saveimg (match. value) <br/> next <br/> myreplace = newstr <br/> end function </P> <p> function saveimg (URL) <br/> temp = Split (URL ,". ") <br/> filename = year (now) & month (now) & Day (now) & hour (now) & minute (now) & Second (now )&". "& temp (ubound (temp) <br/> 'end of renaming the file name <br /> Set XMLHTTP = server. createobject ("Microsoft. XMLHTTP ") <br/> XMLHTTP. open "get", URL, false <br/> XMLHTTP. send <br/> IMG = XMLHTTP. responsebody <br/> set XMLHTTP = nothing <br/> set objadostream = server. createobject ("ADODB. stream ") <br/> objadostream. open () <br/> objadostream. type = 1 <br/> objadostream. write (IMG) <br/> If objadostream. NO content found in size! [Return] "<br/> response. end <br/> end if <br/> objadostream. savetofile (server. mappath (savepath & "\" & filename) <br/> objadostream. seteos <br/> set objadostream = nothing <br/> imgpath01 = savepath & "\" & filename 'Return image path <br/> imgpath01 = Replace (imgpath01 ,"\", "/") <br/> response. write ("image uploaded successfully! [Resume upload] ") <br/> response. write ("<br/> http://www.dns.com.cn <B> domain name 65 yuan, space contact Mo Fei can enjoy a discount, trust Mo Fei chongtian .... </B> ") 'ad <br/> response. write ("<br/>") 'according to your system needs, change the return method. <br/> end function </P> <p> function mofeifoldfso (mpath) <br/> set FSO = server. createobject ("scripting. fileSystemObject ") <br/> if not FSO. folderexists (server. mappath (mpath) Then FSO. createfolder (server. mappath (mpath) <br/> set FSO = nothing <br/> end function <br/> %> </P> <p>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.