ReSaveRemoteFile 함수 의 asp 는 파일 저장 교체 코드 를 찾 습 니 다.

'================================================     '함수 명:ReSaveRemoteFile    '하 다.  사용:파일 저장 바 꾸 기 찾기    '인삼.  수:Str   ----원본 문자열    '인삼.  수:url   ----물론 사이트 URL    '인삼.  수:Dir -----디 렉 터 리 저장    '인삼.  수:InSave ------저장 여부,True,false    '반환 값:포맷 한 문자열    '================================================     Public Function ReSaveRemoteFile(ByVal str, ByVal URL, ByVal Dir,InSave)         Dim s_Content         Dim re         Dim ContentFile, ContentFileUrl         Dim strTempUrl,strFileUrl,DirTemp,PathTemp,FileTemp,Tempi,TempUrlArray,Arr_Path         Dim sAllowExtName         sAllowExtName="rm|swf"         s_Content = str         On Error Resume Next         Set re = New RegExp         re.IgnoreCase = True         re.Global = True         re.Pattern = "((src=|href=)((\S)+[.]{1}(" & sAllowExtName & ")))"         Set ContentFile = re.Execute(s_Content)         Dim sContentUrl(), n, i, bRepeat         n = 0         For Each ContentFileUrl In ContentFile             strFileUrl = Replace(Replace(Replace(Replace(ContentFileUrl.Value, "src=", "", 1, -1, 1), "href=", "", 1, -1, 1), "'", ""), Chr(34), "")             If n = 0 Then                 n = n + 1                 ReDim sContentUrl(n)                 sContentUrl(n) = strFileUrl             Else                 bRepeat = False                 For i = 1 To UBound(sContentUrl)                     If UCase(strFileUrl) = UCase(sContentUrl(i)) Then                         bRepeat = True                         Exit For                     End If                 Next                 If bRepeat = False Then                     n = n + 1                     ReDim Preserve sContentUrl(n)                     sContentUrl(n) = strFileUrl                 End If             End If         Next         If n = 0 Then             ReSaveRemoteFile = s_Content             Exit Function         End If         For i = 1 To n              strTempUrl = sContentUrl(i) : strTempUrl = FormattRemoteUrl(strTempUrl,URL)'파일 주소 받 기            Response.Write(strTempUrl)             IF InSave=True then                 Arr_Path=Split(Dir,"/")                 '----------목록 작성                  For Tempi=0 To Ubound(Arr_Path)                      If Tempi=0 Then                         PathTemp=Arr_Path(0) & "/"                      ElseIf Tempi=Ubound(Arr_Path) Then                         Exit For                      Else                         PathTemp=PathTemp & Arr_Path(Tempi) & "/"                      End If                      If CheckDir(PathTemp)=False Then                         If MakeNewsDir(PathTemp)=False Then                            SaveTf=False                            Exit For                         End If                      End If                   Next                  '------------------------------------------------------                 TempUrlArray=Split(strTempUrl,"/")                 '----------파일 이 존재 하 는 지 확인 하 십시오.파일 이름 을 바 꾸 는 것 이 존재 한다 면                Do while True                      FileTemp=Dir &  MakeRandom(5) & TempUrlArray(Ubound(TempUrlArray))'무 작위 파일 이름 생 성                    If CheckFile(FileTemp)=False then                         Exit Do                     end if                 loop                  '-------------------------------------------------------------------                 Response.Write(FileTemp)                 If SaveRemoteFile(FileTemp,strTempUrl)=True then                     Response.Write("저장 성공")&"
"                    s_Content = Replace(s_Content,sContentUrl(i),FileTemp, 1, -1, 1)'주소 바 꾸 기                     Else                     Response.Write("저장 실패")&"
"                End if             Else                 s_Content = Replace(s_Content,sContentUrl(i),strTempUrl, 1, -1, 1)'주소 바 꾸 기                     End If             Next         Set re = Nothing         PictureExist = True         ReSaveRemoteFile = s_Content         Exit Function     End Function

좋은 웹페이지 즐겨찾기