title: Annotation Configuration for uploading files to server using Spring Integration FTP adapter
body: <p>I'm unable to upload files to a server using annotation based configuration for Spring Integration FTP Adapter. The code that I have used is:</p>
  
  <pre><code>    @SuppressWarnings({ "unchecked", "rawtypes" })
  @Bean
  public IntegrationFlow ftpOut()
  {
  
  
      DefaultFtpSessionFactory defSession=new DefaultFtpSessionFactory();
      defSession.setUsername("chh7kor");
      defSession.setPassword("Geetansh71!!");
      defSession.setPort(21);
      defSession.setHost("10.47.116.158");
      String remoteDirectory=DefaultFtpSessionFactory.DEFAULT_REMOTE_WORKING_DIRECTORY;
  
  
      File localDirectory=new File("C:\\FTP_Default");
  
      return IntegrationFlows.from(Ftp.outboundAdapter(defSession, FileExistsMode.REPLACE).remoteDirectory(remoteDirectory)).get();
  
  
  
  }
  
   @Bean
   public MessageChannel outputChannel() 
   {
       File f=new File(PATH_FOR_FILES_FROM_SERVER);
          File[] allSubFiles=f.listFiles();
  
          DirectChannel dC=new DirectChannel(); 
  
       for(File iterateFiles:allSubFiles)                    
          {
          final Message&lt;File&gt; messageFile = MessageBuilder.withPayload(iterateFiles).build();
            dC.send(messageFile);
  
  
  
          }
       return dC;
  
  }
  </code></pre>
  
  <p>I'm trying to read the files from a local folder and push it into a channel but the IntegrationFlow doesn't allow me to attach a channel to it.Please advise how to achieve the same as this snippet is not helping.</p>