MuleSoft – SFTP – Write content to file and upload to server

1. Add modue of SFTP

After adding module of SFTP, you’ll see below maven dependency added in pom

<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-sftp-connector</artifactId>
&l…


This content originally appeared on DEV Community and was authored by elliot

1. Add modue of SFTP

After adding module of SFTP, you'll see below maven dependency added in pom

<dependency>
    <groupId>org.mule.connectors</groupId>
    <artifactId>mule-sftp-connector</artifactId>
    <version>2.5.1</version>
    <classifier>mule-plugin</classifier>
</dependency>

 

2. Setup local sftp server by docker

This section is omitted; please refer to the following article for details:
install sftp server

 

3. Config sftp in yaml file

  • yaml
sftp:
  host: "127.0.0.1"  
  port: "2222"              
  username: "sftpuser"    
  password: "123456"   
  remotePath: "~/sftp"

 

4. Add SFTP in global element config properties

SFTP global config

Here's xml code of it:

<sftp:config name="SFTP_Config" doc:name="SFTP Config" doc:id="8217af71-2499-4cc2-9506-b81ab62b0e21" >
  <sftp:connection host="${sftp.host}" port="${sftp.port}" username="${sftp.username}" password="${sftp.password}" workingDir="/"/>
</sftp:config>

 

5. Drag and drop an SFTP write processor and config it

SFTP write

Here's xml code of it:

<sftp:write doc:name="Write" doc:id="40143955-915c-4a62-8aeb-c65f8fb344b8" config-ref="SFTP_Config" path="/upload/test2.txt"/>

 

6. Use Bruno & FileZilla to verify the program

  • Bruno

Bruno Test

  • FileZilla

After requesting successfully in bruno, you'll see below result in FileZilla:

FileZilla File

Download the file from FileZilla, and the content of the file should be like this:

{
    "ftpHost": "127.0.0.1",
    "ftpPort": 2222,
    "username": "sftpuser",
    "password": "sftppass",
    "remotePath": "/uploads",
    "fileName": "local-test.txt",
    "fileContent": "SGVsbG8gTG9jYWxTdG9yZSE="
}


This content originally appeared on DEV Community and was authored by elliot


Print Share Comment Cite Upload Translate Updates
APA

elliot | Sciencx (2025-11-06T06:35:27+00:00) MuleSoft – SFTP – Write content to file and upload to server. Retrieved from https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/

MLA
" » MuleSoft – SFTP – Write content to file and upload to server." elliot | Sciencx - Thursday November 6, 2025, https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/
HARVARD
elliot | Sciencx Thursday November 6, 2025 » MuleSoft – SFTP – Write content to file and upload to server., viewed ,<https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/>
VANCOUVER
elliot | Sciencx - » MuleSoft – SFTP – Write content to file and upload to server. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/
CHICAGO
" » MuleSoft – SFTP – Write content to file and upload to server." elliot | Sciencx - Accessed . https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/
IEEE
" » MuleSoft – SFTP – Write content to file and upload to server." elliot | Sciencx [Online]. Available: https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/. [Accessed: ]
rf:citation
» MuleSoft – SFTP – Write content to file and upload to server | elliot | Sciencx | https://www.scien.cx/2025/11/06/mulesoft-sftp-write-content-to-file-and-upload-to-server/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.