复制代码 代码如下:
<% 
  On Error Resume Next 
  Const uploadPath = "/uploads/" '文件存放路径 
  Const allowFileExt = "jpg,wma,swf,gif" '允许被采集的文件类型 
  'Const allowFileSize = "200" 
  Function getFile(url) 
    If url = "" Then 
      Exit Function 
    Else 
      url = Trim(url) 
    End If 
    '获取文件 
    fileExt = Lcase(Mid(url,Instrrev(url, ".")+1)) '文件类型 
    fileName = Lcase(Mid(url,Instrrev(url, "/")+1,Instrrev(url, ".")-Instrrev(url, "/")-1)) '无文件类型的文件名 
    newFilePath = getNow("Date") & "_" & Replace(FormatDateTime(Now(),3),":","") & "_" & cleanFileName(fileName) & "." & fileExt 
    if Instr(","&Lcase(allowFileExt)&",",","&fileExt&",") = 0 Then 
      getFile = "文件类型不允许" 
      Exit Function 
    End If 
    Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP") 
    xmlhttp.open "get",url,false 
    xmlhttp.send 
    'While xmlhttp.readyState <> 4 
    ' xmlhttp.waitForResponse 1000 
    'Wend 
    If xmlhttp.status <> 200 Then 
      getFile="获取文件出错" 
      Exit Function 
    Else 
      Set folder=Server.CreateObject("Scripting.FileSystemObject") 
      Dim folderName 
      folderName = getNow("Year")&getNow("Month") '文件夹 
      If folder.FolderExists(Server.MapPath(uploadPath))=False Then 
        folder.CreateFolder Server.MapPath(uploadPath) 
      End If 
      If folder.FolderExists(Server.MapPath(uploadPath & folderName))=False Then 
        folder.CreateFolder Server.MapPath(uploadPath & folderName) 
      End If 
      Set folder=Nothing 
      file=xmlhttp.ResponseBody 
      If lenb(file) > allowFileSize Then 
        getFile = "文件太大,不能保存!" 
        Exit Function 
      Else 
        Set objAdostream=Server.Createobject("ADODB.Str"&"eam") 
        objAdostream.Open() 
        objAdostream.Type=1 
        objAdostream.Write(file) 
        objAdostream.SaveToFile(Server.Mappath(uploadPath & folderName &"/" & newFilePath)) 
        objAdostream.SetEOS 
        Set objAdostream=Nothing 
        getFile= "<a href="""&uploadPath & folderName &"/" & newFilePath&""" target=""_balnk"">采集成功</a>" 
      End If 
    End If 
    Set xmlhttp=Nothing 
  End Function 
%> 
<script runat="server" language="jscript"> 
function cleanFileName(str){ 
 str = str.replace(/[^_\.a-zA-Z\d]/ig,""); 
 str = str.replace(/^[\/\.]+/,""); 
 return str; 

function getNow(n) 

  d = new Date(); 
  switch (n) 
  { 
    case "Year": 
      return d.getYear(); 
    case "Month": 
     return (d.getMonth() + 1); 
    case "Date": 
      return d.getDate(); 
  } 

</script> 
<%if request("do")="getfile" and request("file") <> "" then 
response.write(getFile(request("file"))) 
else%> 
<form id="gform" method="post" action="?do=getfile" style="display: inline"> 
 <input name="file" type="input" style="font-size:12px;" size="40" value="http://blog.xiaobin.net/uploads/200512/08_093616_01.gif">  
 <input type="Submit" name="Submit" value="采集 " class="button"> 
</form> 
<%end if%>

标签:
自动采集程序

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com

评论“自动采集程序”

暂无“自动采集程序”评论...

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。