How to access FTP in Java?

How can we access files from FTP folder in java web application?

  • What am i doing is uploading some images from client side on to FTP server. I am using FTP client and commons-net.jar to upload the images. I want these images in my Server side application. So plz help me to solve my problem.

  • Answer:

    I'm guessing your server side app needs to "read-in" the image. So in your server app at some point you have to read the image from a file in the FTP folder, where the client has uploaded ... Image image = null; try { File file = new File("/home/user/ftp/image.jpg"); image = ImageIO.read(file); } catch (IOException e) { } Anyway, if you running a java web server your clients may upload the image directly with a http PUT request, without going thru FTP.

Datta at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.