Uploading files directly to specific folder in ftp server using spring spring

I have, I suppose, really newbie question but the fact is I'm newbie in spring framework. How can I upload files to, for example 'upload' folder loceted in root directory of my ftp server? I have tried this: My application context file:

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> <property name="host" value=""/> <property name="username" value="test"/> <property name="password" value="test"/> <property name="clientMode" value="0"/> <property name="fileType" value="2"/> <property name="bufferSize" value="10000"/> </bean> <int:channel id="ftpChannel"/> <int-ftp:outbound-channel-adapter id="outFtpAdapter" channel="ftpChannel" session-factory="ftpClientFactory" remote-directory="/Users/test"/>

and my java code:

ConfigurableApplicationContext context = new FileSystemXmlApplicationContext("/src/citrus/resources/citrus-context.xml"); MessageChannel ftpChannel = context.getBean("ftpChannel", MessageChannel.class); File file = new File("/Users/test/test.txt"); Message<File> fileMessage = MessageBuilder.withPayload(file).build(); ftpChannel.send(fileMessage); context.close();

But this example upload files to root directory. Thanks in advance.


I've just tested it and work well:

<int-ftp:outbound-channel-adapter id="sendFileToServer" auto-create-directory="true" session-factory="ftpSessionFactory" remote-directory="/Users/test"/>

Where my FTP server is an embedded one and its root is:


So the file is stored in the dir:


It is with the latest Spring Integration version.

Which is your version?


  • UDP socket network disconnect behavior on Windows-Linux-Mac
  • Getting socket.io namespace from anywhere in the project
  • What is the difference between NetSuitePortType and NetSuiteService?
  • Spring roo - how to install spring surf
  • Fail SonarQube quality gate when coverage decreases
  • Insert null in a database
  • Spring @Transactional - javax.persistence.TransactionRequiredException
  • How to use HTTP Authentication with PHP and then run the entered data against a database?
  • Issue when joining serf nodes located in different Docker containers
  • Sending rails errors to rspec output
  • IllegalArgumentException: The servlets named [HelloWorlds] and [Hello] are both mapped to the url-pa
  • Getting zero results in search using elastic4s
  • Android NFC read Tags issue. Activity starts each time on data received
  • openssl handshake failed
  • How to resolve docker host names (/etc/hosts) in containers
  • How to change the default configuration files used in bootstrapping of reactJs through npm
  • What is the likely cause of a net::ERR_CONNECTION_ABORTED when uploading a file to Spring
  • Setting src to Base64-encoded image with Javascript is failing
  • NSMutableArray instance used in a block
  • XOR with Neural Networks (Matlab)
  • pymongo replication secondary readreference not work
  • how to save the state in userdefaults of accessory checkmark-iphone
  • Database structure design with variable amounts of fields
  • Read a local file using javascript
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Cross-Platform Protobuf Serialization
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Confusion with PayPal's monthly billing cycle
  • how to add data labels for bar graph in matlab
  • need help with bizarre java.net.HttpURLConnection behavior
  • Checking variable from a different class in C#
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?