开发者

How can i upload a zip folder on FTP server from my local drive using put command of ant tool

开发者 https://www.devze.com 2023-02-14 08:47 出处:网络
开发者_开发知识库in my lacal drive i created a zip folder whom i want to upload at FTP server by using the put command of ANT.pls give me some idea... Don\'t know if you\'re meaning this but check the

开发者_开发知识库in my lacal drive i created a zip folder whom i want to upload at FTP server by using the put command of ANT.pls give me some idea...


Don't know if you're meaning this but check the Apache Commons library. http://commons.apache.org/net/index.html

Would be something like:

    import org.apache.commons.net.ftp.*;

...

...

FTPClient ftp = new FTPClient();
        ftp.connect(FTP_HOST);
        ftp.login(FTP_USER, FTP_PASS);
        ftp.changeWorkingDirectory(FTP_PATH);
        ftp.setFileTransferMode(FTPClient.BINARY_FILE_TYPE);
        FileInputStream fis = new FileInputStream(fileName);
        ftp.storeFile(fileName,fis);
        ftp.logout();
0

精彩评论

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