回 帖 发 新 帖 刷新版面

主题:采集!!!

同一个采集项目,在本地测试没问题,但是传到服务器上数字可采集
但图片采不了
<% 
  On Error Resume Next 
  
  Function getFile(url) 
    If url = "" Then 
      Exit Function 
    Else 
      url = fso_myfile(Trim(url),"mp3music_wma/") 
    End If 
      End Function
      '==============================================================
        '检查文件是否存在,如果不存在就创建该文件夹
        '==============================================================
           Private Function TlMyfile(byref Myfile_Str) 
              Set Fso = Server.CreateObject("Scripting.FileSystemObject")
                if FSO.FolderExists(server.MapPath(Myfile_Str&"")) Then 
                       zj_FSO = True
                else
                       Fso.CreateFolder(Server.Mappath(Myfile_Str&""))
                end if

            Set Fso=Nothing
                             TlMyfile = Myfile_Str
           end Function
        '==============================================================
        '利用fso检测文件是否存在,存在返回true,不存在返回false
        '==============================================================
            Private Function IsExists(byref filespec) 
            Set FSO  =  Server.CreateObject("Scripting.FileSystemObject")  

                If (FSO.FileExists(server.MapPath(filespec))) Then
                 IsExists = True
                     Else
                 IsExists = False
                     End If
                 Set FSO  = Nothing
            End Function

    '获取文件 
    Private Function fso_myfile(Myfile_url,Myfile_ToFile)
               Save_Url = Myfile_url
                  If Instr(Myfile_url,"://") > 0 then
                         Myfile_url = Replace(Myfile_url,"://","")
                         Myfile_url = Replace(Myfile_url,"//","/")
                         Myfile_url = Replace(Myfile_url,"\\","/")
                         Myfile_url = Replace(Myfile_url,"\","/")
                         Myfile_url_F = split(Myfile_url,"/")
                         Myfile_url = Replace(Myfile_url,Myfile_url_f(0),"")
                         
                  Else
                        Myfile_url = Replace(Myfile_url,"//","/")
                        Myfile_url = Replace(Myfile_url,"\\","/")
                        Myfile_url = Replace(Myfile_url,"\","/")
                  End If
                            
                           MusicADOName = Myfile_url_f(ubound(Myfile_url_f))
                           MyFile_is_ToFile = "/"&Myfile_ToFile & MyFile_url
    if IsExists(MyFile_is_ToFile) = false then
                       MyFile_for = split(MyFile_is_ToFile,"/")
                          If Trim(MyFile_For(ubound(MyFile_For))) = "" then
                                  Over_MyFile_i = ubound(MyFile_for)-2
                          Else
                                  Over_MyFile_i = ubound(MyFile_for)-1
                          End if
              For MyFile_i = 1 to Over_MyFile_i
                  Fldr_str ="/" & MyFile_For(MyFile_i)
                  Fldr = Fldr & Fldr_str
                  TlMyFile(Fldr)
              Next
             
                Fso_MyFile = SaveFiles(save_url,Myfile_is_ToFile)  
    else
                response.write "该文件已经存在..."
                fso_myfile = Myfile_is_ToFile
    end if
       


             End Function
        '*****************************************************************
        '   function(私有)
        '   作用 :利用流保存文件,保存音乐文件
        '*****************************************************************
    Function SaveFiles(ByVal GetUrl, ByVal ToFile)

    set xmlhttp=server.createobject("MSXML2.ServerXMLHTTP")
    xmlhttp.open "get",GetUrl,false,"",""
    xmlhttp.send
   If xmlhttp.status = 200 Then
    MusicADO=xmlhttp.ResponseBody
    set objAdostream=server.createobject("ADODB.Stream")
    objAdostream.type=1
    objAdostream.Mode=3
    objAdostream.Open()
    objAdostream.Write(MusicADO)
        objAdostream.SaveToFile(server.mappath(ToFile)),2
    objAdostream.SetEOS
    set xmlhttp=nothing
    set objAdostream=nothing
    Response.Write "保存成功:<font color=red>"&formatnumber(len(MusicADO)/1024*2,2)&"</font>Kb"
    response.Flush
         SaveFiles = ToFile
        else
    Response.Write "保存失败:<font color=red>0</font>Kb"
    response.Flush
       SaveFiles = ToFile
  end if
        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://www.linuxlong.com/images/label.gif">  
 <input type="Submit" name="Submit" value="采集 " class="button"> 
</form> 
<%end if%>

这是我们的代码
可是不知道为什么就是采集不了图片

回复列表 (共1个回复)

沙发

是不是用到了什么特殊的组件?比较一下本地和服务器的配置有什么不同!

我来回复

您尚未登录,请登录后再回复。点此登录或注册