SimpleFTP

A Simple Java FTP Client Package

SimpleFTP is a Java FTP client package that lets you connect to FTP servers and upload files.

Download simpleftp.jar

Using SimpleFTP in your Java programs

To use SimpleFTP, simply add simpleftp.jar to your classpath and import the package in whichever classes will use it.

import org.jibble.simpleftp.*;

Upload files to an FTP server

It's easy to use SimpleFTP to connect to an FTP server. You can log in anonymously, or provide a specific username and password.

Once connected, you can upload files. You might find this package useful for uploading webcam images to an FTP server so they can be seen on a web server. Make sure you use binary mode when uploading images and suchlike, or they may become corrupted.

try {
    SimpleFTP ftp = new SimpleFTP();
    
    // Connect to an FTP server on port 21.
    ftp.connect("ftp.somewhere.net", 21, "username", "password");
    
    // Set binary mode.
    ftp.bin();
    
    // Change to a new working directory on the FTP server.
    ftp.cwd("web");
    
    // Upload some files.
    ftp.stor(new File("webcam.jpg"));
    ftp.stor(new File("comicbot-latest.png"));
    
    // You can also upload from an InputStream, e.g.
    ftp.stor(new FileInputStream(new File("test.png")), "test.png");
    ftp.stor(someSocket.getInputStream(), "blah.dat");
    
    // Quit from the FTP server.
    ftp.disconnect();
}
catch (IOException e) {
    // Jibble.
}

SimpleFTP is a simple package I created to upload small files to my FTP server. This was all the functionality I required, so it does not let you download files.

Licensing

This software product is OSI Certified Open Source Software, available under the GNU General Public License (GPL). Since the GPL may be too restrictive for use in proprietary applications, a commercial license is also provided.

Purchase a commercial license for this software.

 

Search this site

 

Copyright Paul Mutton 2001-2013
http://www.jibble.org/
Feedback welcomed
email

~
Dreamhost
Web Hosting

~
Dreamhost
Web Hosting