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="127.0.0.1"/>
<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:
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?