主页 > 知识库 > 自动采集程序

自动采集程序

热门标签:武夷山旅游地图标注 修改地图标注 金昌电话机器人价格 莱西电子地图标注 外呼系统API接口 怎么在地图标注自己 个人可以办理400电话么 县域地图标注打印店 凤台百度地图标注店
复制代码 代码如下:


  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%>

标签:楚雄 凉山 上海 南京 邢台 赤峰 通辽 清远

巨人网络通讯声明:本文标题《自动采集程序》,本文关键词  自动,采集,程序,自动,采集,;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 下面列出与本文章《自动采集程序》相关的同类信息!
  • 本页收集关于自动采集程序的相关信息资讯供网民参考!
  • 企业400电话

    智能AI客服机器人
    15000

    在线订购

    合计11份范本:公司章程+合伙协议+出资协议+合作协议+股权转让协议+增资扩股协议+股权激励+股东会决议+董事会决议

    推荐文章

    上一篇:登陆asp class

    下一篇:js+asp总结