· Apr 20, 2017

Cache FTP issue

Hi All,

         We can sent the file to FTP server using CMD prompt.

         When trying send file using cache FTP. it automatically logged out.

          While cache FTP access (read/write) FTP server it automatically logged out.


S ftp=##class(%Net.FtpSession).%New() 
     S Server="test"
     S Username="test"
     S Password="test"
     I $L(Server)=0||($L(Username)=0)||($L(Password)=0) S Status="Invalid Credentials" Q Status 
     S ConnSt=ftp.Connect(Server,Username,Password)
     I 'ConnSt S Status="Couldn't Estabilish the FTP connection" Q Status
     ;Linking the file 
     D ftp.Binary()    
      S filestream=##class(%FileBinaryStream).%New()  
      S LinkSt=filestream.LinkToFile(File)  
      I 'LinkSt S Status="Couldn't Link to the ZIP file" G LOGOUT
      ;Storing the file to the FTP
      S FtpStoreName="TEST.ZIP"
      S SaveSt=ftp.Store(FtpStoreName,filestream)    ;This Step it automatically logout    
      I 'SaveSt S Status="Failed to move the ZIP file to the FTP Server" G LOGOUT

version : cache 16


Prabakaran A.

Discussion (1)1
Log in or sign up to continue