Java Requires Chilkat v9.5.0.89+
Chilkat2 Java
Wasabi FTP Upload
See more Wasabi Examples
Demonstrates how to upload a file to Wasabi using FTP.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Ftp2;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Ftp2 ftp = new Ftp2();
// Use the domain for the bucket you'll be managing.
ftp.setHostname("s3.s3.us-west-1.wasabisys.com");
// Use your root account username (email address) and root account password
ftp.setUsername("root_account_username");
ftp.setPassword("root_account_password");
ftp.setSsl(true);
ftp.setPort(990);
try {
ftp.connect();
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
// Upload a file (starfish.jpg) to the bucket named "chilkat"
String localFilePath = "qa_data/jpg/starfish.jpg";
String remoteBucketPath = "/chilkat/starfish.jpg";
try {
ftp.putFile(localFilePath, remoteBucketPath);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println("File uploaded.");
}
}