开发者

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

开发者 https://www.devze.com 2023-03-23 01:57 出处:网络
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 he

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 m开发者_StackOverflow社区e to solve my problem.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消