Re: Multiple Image Upload Paths

  •  03-15-2004, 8:50 AM

    Re: Multiple Image Upload Paths

    Hsq,

     

    No, I don't think you can upload the files to two diffent servers at the same time.

     

    I suggest you use the FTP to send the files to the other server. Below is the code I used before to FTP the files in the fly.

     

     

    <%

    Public Function FTP(file_tobe_FTP)

    Dim Output, ReturnCode, StrScript

    StrHost = "xx.xx.xx.xx"

    StrUser = ""

    StrPass = ""

    StrMode = "ascii"

    LocalDir = ""

    RemoteDir = ""

    file_tobe_FTP = server.MapPath(file_tobe_FTP)

    Dim objFSO, strFile, objTempFldr, objFile, objRegExp

    Dim objShell, WSX, strLog, StrErrorLog

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    Set objTempFldr = objFSO.GetSpecialFolder(TemporaryFolder)

    strFile = objFSO.GetTempName

    strFile = objTempFldr & strFile &".ftp"

    If not objFSO.FileExists(strFile) then

    objFSO.CreateTextFile(strFile)

    end if

    Set objFile = objFSO.OpenTextFile(strFile,2,true)

    objFile.WriteLine(StrUser)

    objFile.WriteLine(StrPass)

    If LocalDir <> "" Then

    objFile.WriteLine("lcd "& LocalDir)

    End if

    If RemoteDir <> "" Then

    objFile.WriteLine("cd "& RemoteDir)

    End if

    objFile.WriteLine StrMode

    objFile.WriteLine("put "&file_tobe_FTP)

    objFile.WriteLine("bye")

    objFile.close

    Set objShell = Server.CreateObject("WScript.Shell")

    set WSX = objShell.Exec( "ftp.exe -i -s:" & strFile & " " & strHost )

    set ReturnCode = WSX.StdErr

    set Output = WSX.stdOut

    strErrorLog = objTempFldr.Path & "ftpErrors.txt"

    strLog = objTempFldr.Path & "ftpLog.txt"

    Set objFile = objFSO.OpenTextFile( strErrorLog, 2, True )

    objFile.Write( ReturnCode.ReadAll() )

    Set objFile = objFSO.OpenTextFile( strLog, 2, True )

    objFile.Write( Output.ReadAll() )

    objFile.Close()

    'clean up

    objFSO.DeleteFile strFile, True

    set objFSO = nothing

    set objFile = nothing

    End Function

    %>


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread