Java FTP Client Upload Example - Apache Commons Net

Java FTP Client is used to upload files to FTP server. Recently I was working in a web project where I had to upload a lot of images to the FTP server. Few days back, I wrote a program to resize image in java. My actual program was to resize all the images in a directory and then upload to FTP server using Apache Commons Net API.

Java FTP Client Example

Here I am providing a Java FTP client program to upload files to FTP server using Apache Commons Net API.

You can use the above program to connect to an FTP server and then upload files to the server. Make sure you provide FTP Host, user, and password details correctly in the program. You can get these details when you create an FTP user.

The other important point to note is the server directory location. It’s relative to the FTP user home directory. Also, once you are done with uploading all the files, close the connection to the server and release resources.

By admin

Leave a Reply

%d bloggers like this: