ftp下载文件java
(KmConfigkmConfig,StringfileName,StringclientFileName,OutputStreamoutputStream){
	try{
		StringftpHost=kmConfig.getFtpHost();
		intport=kmConfig.getFtpPort();
		StringuserName=kmConfig.getFtpUser();
		StringpassWord=kmConfig.getFtpPassword();
		Stringpath=kmConfig.getFtpPath();
		FtpClientftpClient=newFtpClient(ftpHost,port);//ftpHost为FTP服务器的IP地址,port为FTP服务器的登陆端口,ftpHost为String型,port为int型。
		ftpClient.login(userName,passWord);//userName、passWord分别为FTP服务器的登陆用户名和密码
		ftpClient.binary();
		ftpClient.cd(path);//path为FTP服务器上保存上传文件的路径。
		try{
			TelnetInputStreamin=ftpClient.get(fileName);
			byte[]bytes=newbyte[1024];
			intcnt=0;
			while((cnt=in.read(bytes,0,bytes.length))!=-1){
				outputStream.write(bytes,0,cnt);
			}
			//##############################################
			//这里文件就已经下载完了,自己理解一下
			//#############################################
			
			outputStream.close();
			in.close();
		}catch(Exceptione){
			ftpClient.closeServer();
			e.printStackTrace();
		}
		ftpClient.closeServer();
	}catch(Exceptione){
		System.out.println("下载文件失败!请检查系统FTP设置,并确认FTP服务启动");
	}
}
B. java 下载异地FTP中的zip文件
好像需要一个支持jar包把,把ftp4j的下载地址贴出来
C. java高手进来,要用JAVA做个从FTP下载文件的软件,有没有这方面的教程或者资料,急急急!!!!
Java阵营中有这方面的免费开源技术,最权威的是Apache的Java开源阵营。
您可以应用Apache commons开源组件集合中的Net组件包,到官网免费获得:
http://commons.apache.org/net/
通过它可以轻松的创建FTP、FTPS 、TFTP等下载程序,很方便。具体方法参见官网的文档和示例程序,一点也不难!示例程序如下:
http://commons.apache.org/net/examples/ftp/FTPClientExample.java
如果还不能解决,需要帮忙,可以QQ联络我:[email protected]。
D. java如何实现txt下载 就是从远程FTP服务器上直接把TXT文本下载下来!
strUrl为文件地址,fileName为文件在本地的保存路径,试试吧~
public static void writeFile(String strUrl, String fileName) {
  URL url = null;
  try {
   url = new URL(strUrl);
  } catch (MalformedURLException e2) {
   e2.printStackTrace();
  }
  InputStream is = null;
  try {
   is = url.openStream();
  } catch (IOException e1) {
   e1.printStackTrace();
  }
  OutputStream os = null;
  try {
   os = new FileOutputStream( fileName);
   int bytesRead = 0;
   byte[] buffer = new byte[8192];
   while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
    os.write(buffer, 0, bytesRead);
   }
   System.out.println("下载成功:"+strUrl);
  } catch (FileNotFoundException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  }
 }
E. Java的ftp操作方法有哪几种
FTP(File Transfer Protocol)是 Internet 上用来传送文件的协议(文件传输协议)。它是为了我们能够在 Internet 上互相传送文件而制定的的文件传送标准,规定了 Internet 上文件如何传送。也就是说,通过 FTP 协议,我们就可以跟 Internet 上的 FTP 服务器进行文件的上传(Upload)或下载(Download)等动作。
和其他 Internet 应用一样,FTP 也是依赖于客户程序/服务器关系的概念。在 Internet 上有一些网站,它们依照 FTP 协议提供服务,让网友们进行文件的存取,这些网站就是 FTP 服务器。网上的用户要连上 FTP 服务器,就要用到 FPT 的客户端软件,通常 Windows 都有“ftp”命令,这实际就是一个命令行的 FTP 客户程序,另外常用的 FTP 客户程序还有 CuteFTP、Ws_FTP、FTP Explorer等。
要连上 FTP 服务器(即“登陆”),必须要有该 FTP 服务器的帐号。如果是该服务器主机的注册客户,你将会有一个 FTP 登陆帐号和密码,就凭这个帐号密码连上该服务器。但 Internet 上有很大一部分 FTP 服务器被称为“匿名”(Anonymous)FTP 服务器。这类服务器的目的是向公众提供文件拷贝服务,因此,不要求用户事先在该服务器进行登记注册。
Anonymous(匿名文件传输)能够使用户与远程主机建立连接并以匿名身份从远程主机上拷贝文件,而不必是该远程主机的注册用户。用户使用特殊的用户名“anonymous”和“guest”就可有限制地访问远程主机上公开的文件。现在许多系统要求用户将Emai1地址作为口令,以便更好地对访问进行跟综。出于安全的目的,大部分匿名FTP主机一般只允许远程用户下载(download)文件,而不允许上载(upload)文件。也就是说,用户只能从匿名FTP主机拷贝需要的文件而不能把文件拷贝到匿名FTP主机。另外,匿名FTP主机还采用了其他一些保护措施以保护自己的文件不至于被用户修改和删除,并防止计算机病毒的侵入。在具有图形用户界面的 WorldWild Web环境于1995年开始普及以前,匿名FTP一直是Internet上获取信息资源的最主要方式,在Internet成千上万的匿名PTP主机中存储着无以计数的文件,这些文件包含了各种各样的信息,数据和软件。 人们只要知道特定信息资源的主机地址, 就可以用匿名FTP登录获取所需的信息资料。虽然目前使用WWW环境已取代匿名FTP成为最主要的信息查询方式,但是匿名FTP仍是 Internet上传输分发软件的一种基本方法
F. java 实现ftp上传下载,windows下和linux下游何区别
packagecom.weixin.util;
importjava.io.File;
importjava.io.FileOutputStream;
importjava.io.IOException;
importjava.io.InputStream;
importjava.io.OutputStream;
importjava.io.PrintWriter;
importjava.io.RandomAccessFile;
importorg.apache.commons.net.PrintCommandListener;
importorg.apache.commons.net.ftp.FTP;
importorg.apache.commons.net.ftp.FTPClient;
importorg.apache.commons.net.ftp.FTPFile;
importorg.apache.commons.net.ftp.FTPReply;
importcom.weixin.constant.DownloadStatus;
importcom.weixin.constant.UploadStatus;
/**
*支持断点续传的FTP实用类
*@version0.1实现基本断点上传下载
*@version0.2实现上传下载进度汇报
*@version0.3实现中文目录创建及中文文件创建,添加对于中文的支持
*/
publicclassContinueFTP{
publicFTPClientftpClient=newFTPClient();
publicContinueFTP(){
//设置将过程中使用到的命令输出到控制台
this.ftpClient.addProtocolCommandListener(newPrintCommandListener(newPrintWriter(System.out)));
}
/**
*连接到FTP服务器
*@paramhostname主机名
*@paramport端口
*@paramusername用户名
*@parampassword密码
*@return是否连接成功
*@throwsIOException
*/
publicbooleanconnect(Stringhostname,intport,Stringusername,Stringpassword)throwsIOException{
ftpClient.connect(hostname,port);
ftpClient.setControlEncoding("GBK");
if(FTPReply.isPositiveCompletion(ftpClient.getReplyCode())){
if(ftpClient.login(username,password)){
returntrue;
}
}
disconnect();
returnfalse;
}
/**
*从FTP服务器上下载文件,支持断点续传,上传百分比汇报
*@paramremote远程文件路径
*@paramlocal本地文件路径
*@return上传的状态
*@throwsIOException
*/
publicDownloadStatusdownload(Stringremote,Stringlocal)throwsIOException{
//设置被动模式
ftpClient.enterLocalPassiveMode();
//设置以二进制方式传输
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
DownloadStatusresult;
//检查远程文件是否存在
FTPFile[]files=ftpClient.listFiles(newString(remote.getBytes("GBK"),"iso-8859-1"));
if(files.length!=1){
System.out.println("远程文件不存在");
returnDownloadStatus.Remote_File_Noexist;
}
longlRemoteSize=files[0].getSize();
Filef=newFile(local);
//本地存在文件,进行断点下载
if(f.exists()){
longlocalSize=f.length();
//判断本地文件大小是否大于远程文件大小
if(localSize>=lRemoteSize){
System.out.println("本地文件大于远程文件,下载中止");
returnDownloadStatus.Local_Bigger_Remote;
}
//进行断点续传,并记录状态
FileOutputStreamout=newFileOutputStream(f,true);
ftpClient.setRestartOffset(localSize);
InputStreamin=ftpClient.retrieveFileStream(newString(remote.getBytes("GBK"),"iso-8859-1"));
byte[]bytes=newbyte[1024];
longstep=lRemoteSize/100;
longprocess=localSize/step;
intc;
while((c=in.read(bytes))!=-1){
out.write(bytes,0,c);
localSize+=c;
longnowProcess=localSize/step;
if(nowProcess>process){
process=nowProcess;
if(process%10==0)
System.out.println("下载进度:"+process);
//TODO更新文件下载进度,值存放在process变量中
}
}
in.close();
out.close();
booleanisDo=ftpClient.completePendingCommand();
if(isDo){
result=DownloadStatus.Download_From_Break_Success;
}else{
result=DownloadStatus.Download_From_Break_Failed;
}
}else{
OutputStreamout=newFileOutputStream(f);
InputStreamin=ftpClient.retrieveFileStream(newString(remote.getBytes("GBK"),"iso-8859-1"));
byte[]bytes=newbyte[1024];
longstep=lRemoteSize/100;
longprocess=0;
longlocalSize=0L;
intc;
while((c=in.read(bytes))!=-1){
out.write(bytes,0,c);
localSize+=c;
longnowProcess=localSize/step;
if(nowProcess>process){
process=nowProcess;
if(process%10==0)
System.out.println("下载进度:"+process);
//TODO更新文件下载进度,值存放在process变量中
}
}
in.close();
out.close();
booleanupNewStatus=ftpClient.completePendingCommand();
if(upNewStatus){
result=DownloadStatus.Download_New_Success;
}else{
result=DownloadStatus.Download_New_Failed;
}
}
returnresult;
}
/**
*上传文件到FTP服务器,支持断点续传
*@paramlocal本地文件名称,绝对路径
*@paramremote远程文件路径,使用/home/directory1/subdirectory/file.ext按照Linux上的路径指定方式,支持多级目录嵌套,支持递归创建不存在的目录结构
*@return上传结果
*@throwsIOException
*/
publicUploadStatusupload(Stringlocal,Stringremote)throwsIOException{
//设置PassiveMode传输
ftpClient.enterLocalPassiveMode();
//设置以二进制流的方式传输
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
ftpClient.setControlEncoding("GBK");
UploadStatusresult;
//对远程目录的处理
StringremoteFileName=remote;
if(remote.contains("/")){
remoteFileName=remote.substring(remote.lastIndexOf("/")+1);
//创建服务器远程目录结构,创建失败直接返回
if(CreateDirecroty(remote,ftpClient)==UploadStatus.Create_Directory_Fail){
returnUploadStatus.Create_Directory_Fail;
}
}
//检查远程是否存在文件
FTPFile[]files=ftpClient.listFiles(newString(remoteFileName.getBytes("GBK"),"iso-8859-1"));
if(files.length==1){
longremoteSize=files[0].getSize();
Filef=newFile(local);
longlocalSize=f.length();
if(remoteSize==localSize){
returnUploadStatus.File_Exits;
}elseif(remoteSize>localSize){
returnUploadStatus.Remote_Bigger_Local;
}
//尝试移动文件内读取指针,实现断点续传
result=uploadFile(remoteFileName,f,ftpClient,remoteSize);
//如果断点续传没有成功,则删除服务器上文件,重新上传
if(result==UploadStatus.Upload_From_Break_Failed){
if(!ftpClient.deleteFile(remoteFileName)){
returnUploadStatus.Delete_Remote_Faild;
}
result=uploadFile(remoteFileName,f,ftpClient,0);
}
}else{
result=uploadFile(remoteFileName,newFile(local),ftpClient,0);
}
returnresult;
}
/**
*断开与远程服务器的连接
*@throwsIOException
*/
publicvoiddisconnect()throwsIOException{
if(ftpClient.isConnected()){
ftpClient.disconnect();
}
}
/**
*递归创建远程服务器目录
*@paramremote远程服务器文件绝对路径
*@paramftpClientFTPClient对象
*@return目录创建是否成功
*@throwsIOException
*/
(Stringremote,FTPClientftpClient)throwsIOException{
UploadStatusstatus=UploadStatus.Create_Directory_Success;
Stringdirectory=remote.substring(0,remote.lastIndexOf("/")+1);
if(!directory.equalsIgnoreCase("/")&&!ftpClient.changeWorkingDirectory(newString(directory.getBytes("GBK"),"iso-8859-1"))){
//如果远程目录不存在,则递归创建远程服务器目录
intstart=0;
intend=0;
if(directory.startsWith("/")){
start=1;
}else{
start=0;
}
end=directory.indexOf("/",start);
while(true){
StringsubDirectory=newString(remote.substring(start,end).getBytes("GBK"),"iso-8859-1");
if(!ftpClient.changeWorkingDirectory(subDirectory)){
if(ftpClient.makeDirectory(subDirectory)){
ftpClient.changeWorkingDirectory(subDirectory);
}else{
System.out.println("创建目录失败");
returnUploadStatus.Create_Directory_Fail;
}
}
start=end+1;
end=directory.indexOf("/",start);
//检查所有目录是否创建完毕
if(end<=start){
break;
}
}
}
returnstatus;
}
/**
*上传文件到服务器,新上传和断点续传
*@paramremoteFile远程文件名,在上传之前已经将服务器工作目录做了改变
*@paramlocalFile本地文件File句柄,绝对路径
*@paramprocessStep需要显示的处理进度步进值
*@paramftpClientFTPClient引用
*@return
*@throwsIOException
*/
publicUploadStatusuploadFile(StringremoteFile,FilelocalFile,FTPClientftpClient,longremoteSize)throwsIOException{
UploadStatusstatus;
//显示进度的上传
longstep=localFile.length()/100;
longprocess=0;
longlocalreadbytes=0L;
RandomAccessFileraf=newRandomAccessFile(localFile,"r");
OutputStreamout=ftpClient.appendFileStream(newString(remoteFile.getBytes("GBK"),"iso-8859-1"));
//断点续传
if(remoteSize>0){
ftpClient.setRestartOffset(remoteSize);
process=remoteSize/step;
raf.seek(remoteSize);
localreadbytes=remoteSize;
}
byte[]bytes=newbyte[1024];
intc;
while((c=raf.read(bytes))!=-1){
out.write(bytes,0,c);
localreadbytes+=c;
if(localreadbytes/step!=process){
process=localreadbytes/step;
System.out.println("上传进度:"+process);
//TODO汇报上传状态
}
}
out.flush();
raf.close();
out.close();
booleanresult=ftpClient.completePendingCommand();
if(remoteSize>0){
status=result?UploadStatus.Upload_From_Break_Success:UploadStatus.Upload_From_Break_Failed;
}else{
status=result?UploadStatus.Upload_New_File_Success:UploadStatus.Upload_New_File_Failed;
}
returnstatus;
}
publicstaticvoidmain(String[]args){
ContinueFTPmyFtp=newContinueFTP();
try{
System.err.println(myFtp.connect("10.10.6.236",21,"5","jieyan"));
// myFtp.ftpClient.makeDirectory(newString("歌曲".getBytes("GBK"),"iso-8859-1"));
// myFtp.ftpClient.changeWorkingDirectory(newString("歌曲".getBytes("GBK"),"iso-8859-1"));
// myFtp.ftpClient.makeDirectory(newString("爱你等于爱自己".getBytes("GBK"),"iso-8859-1"));
// System.out.println(myFtp.upload("E:\yw.flv","/yw.flv",5));
// System.out.println(myFtp.upload("E:\爱你等于爱自己.mp4","/爱你等于爱自己.mp4"));
//System.out.println(myFtp.download("/爱你等于爱自己.mp4","E:\爱你等于爱自己.mp4"));
myFtp.disconnect();
}catch(IOExceptione){
System.out.println("连接FTP出错:"+e.getMessage());
}
}
}
G. 看了一段java代码是从FTP上下载文件,ftpClient.setBufferSize()这个是什么用处,要怎么使用它
缓冲区大小,等从ftp下载的数据存储到缓冲区,等缓冲区满了,进行磁盘读写。
H. java 使用ftp 下载文件在windows环境下正常,在linux下载不了
是不是文件的读写权限问题,linux的权限控制比windows严格的多
I. ftp java 下载的时候怎么保存到指定位置
通过工具类来实现本地路径定义和下载即可。
import hkrt.b2b.view.util.Log;
import hkrt.b2b.view.util.ViewUtil;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
public class CCFCCBFTP {
    /**
     * 上传文件
     *
     * @param fileName
     * @param plainFilePath 明文文件路径路径
     * @param filepath
     * @return 
     * @throws Exception
     */
    public static String fileUploadByFtp(String plainFilePath, String fileName, String filepath) throws Exception {
        FileInputStream fis = null;
        ByteArrayOutputStream bos = null;
        FTPClient ftpClient = new FTPClient();
        String bl = "false";
        try {
            fis = new FileInputStream(plainFilePath);
            bos = new ByteArrayOutputStream(fis.available());
            byte[] buffer = new byte[1024];
            int count = 0;
            while ((count = fis.read(buffer)) != -1) {
                bos.write(buffer, 0, count);
            }
            bos.flush();
            Log.info("加密上传文件开始");
            Log.info("连接远程上传服务器"+CCFCCBUtil.CCFCCBHOSTNAME+":"+22);
            ftpClient.connect(CCFCCBUtil.CCFCCBHOSTNAME, 22);
            ftpClient.login(CCFCCBUtil.CCFCCBLOGINNAME, CCFCCBUtil.CCFCCBLOGINPASSWORD);
            FTPFile[] fs;
            fs = ftpClient.listFiles();
            for (FTPFile ff : fs) {
                if (ff.getName().equals(filepath)) {
                    bl="true";
                    ftpClient.changeWorkingDirectory("/"+filepath+"");
                }
            }
             Log.info("检查文件路径是否存在:/"+filepath);
             if("false".equals(bl)){
                 ViewUtil.dataSEErrorPerformedCommon( "查询文件路径不存在:"+"/"+filepath);
                  return bl;
            }
            ftpClient.setBufferSize(1024);
            ftpClient.setControlEncoding("GBK");
            // 设置文件类型(二进制)
            ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
            ftpClient.storeFile(fileName, fis);
            Log.info("上传文件成功:"+fileName+"。文件保存路径:"+"/"+filepath+"/");
            return bl;
        } catch (Exception e) {
            throw e;
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (Exception e) {
                    Log.info(e.getLocalizedMessage(), e);
                }
            }
            if (bos != null) {
                try {
                    bos.close();
                } catch (Exception e) {
                    Log.info(e.getLocalizedMessage(), e);
                }
            }
        }
    
    }
    /**
     *下载并解压文件
     *
     * @param localFilePath
     * @param fileName
     * @param routeFilepath
     * @return 
     * @throws Exception
     */
    public static String fileDownloadByFtp(String localFilePath, String fileName,String routeFilepath) throws Exception {
        FileInputStream fis = null;
        ByteArrayOutputStream bos = null;
        FileOutputStream fos = null;
        FTPClient ftpClient = new FTPClient();
        String SFP = System.getProperty("file.separator");
        String bl = "false";
        try {
            Log.info("下载并解密文件开始");
            Log.info("连接远程下载服务器"+CCFCCBUtil.CCFCCBHOSTNAME+":"+22);
            ftpClient.connect(CCFCCBUtil.CCFCCBHOSTNAME, 22);
            ftpClient.login(CCFCCBUtil.CCFCCBLOGINNAME, CCFCCBUtil.CCFCCBLOGINPASSWORD);
CMBCUtil.CMBCLOGINPASSWORD);
            FTPFile[] fs;        
            
            ftpClient.makeDirectory(routeFilepath);
            ftpClient.changeWorkingDirectory(routeFilepath);
            bl = "false";
            fs = ftpClient.listFiles();
            for (FTPFile ff : fs) {
                if (ff.getName().equals(fileName)) {
                        bl = "true";
                        Log.info("下载文件开始。");
                        ftpClient.setBufferSize(1024);
                        // 设置文件类型(二进制)
                        ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
                        InputStream is = ftpClient.retrieveFileStream(fileName);
                        bos = new ByteArrayOutputStream(is.available());
                        byte[] buffer = new byte[1024];
                        int count = 0;
                        while ((count = is.read(buffer)) != -1) {
                            bos.write(buffer, 0, count);
                        }
                        bos.flush();
                        fos = new FileOutputStream(localFilePath+SFP+fileName);
                        fos.write(bos.toByteArray());
                        Log.info("下载文件结束:"+localFilePath);
                }
            }
            Log.info("检查文件是否存:"+fileName+"  "+bl);
            if("false".equals(bl)){
                 ViewUtil.dataSEErrorPerformedCommon("查询无结果,请稍后再查询。");
                 return bl;
            }
          return bl;
        } catch (Exception e) {
            throw e;
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (Exception e) {
                    Log.info(e.getLocalizedMessage(), e);
                }
            }
            if (bos != null) {
                try {
                    bos.close();
                } catch (Exception e) {
                    Log.info(e.getLocalizedMessage(), e);
                }
            }
            if (fos != null) {
                try {
                    fos.close();
                } catch (Exception e) {
                    Log.info(e.getLocalizedMessage(), e);
                }
            }
        }
    }
//       调用样例:
    public static void main(String[] args) {
        try {
            // 明文文件路径
            String plainFilePath = "D:/req_20150204_0011.txt";
            // 密文文件路径
            String secretFilePath = "req_20150204_00134.txt";
          fileDownloadByFtp("D://123.zip","123.zip","req/20150228");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
J. 如何在Java程序中实现FTP的上传下载功能
以下是这三部分的JAVA源程序: (1)显示FTP服务器上的文件 void ftpList_actionPerformed(ActionEvent e) {String server=serverEdit.getText();//输入的FTP服务器的IP地址 String user=userEdit.getText();//登录FTP服务器的用户名 String password=passwordEdit.getText();//登录FTP服务器的用户名的口令 String path=pathEdit.getText();//FTP服务器上的路径 try {FtpClient ftpClient=new FtpClient();//创建FtpClient对象 ftpClient.openServer(server);//连接FTP服务器 ftpClient.login(user, password);//登录FTP服务器 if (path.length()!=0) ftpClient.cd(path); TelnetInputStream is=ftpClient.list(); int c; while ((c=is.read())!=-1) { System.out.print((char) c);} is.close(); ftpClient.closeServer();//退出FTP服务器 } catch (IOException ex) {;} } (2)从FTP服务器上下传一个文件 void getButton_actionPerformed(ActionEvent e) { String server=serverEdit.getText(); String user=userEdit.getText(); String password=passwordEdit.getText(); String path=pathEdit.getText(); String filename=filenameEdit.getText(); try { FtpClient ftpClient=new FtpClient(); ftpClient.openServer(server); ftpClient.login(user, password); if (path.length()!=0) ftpClient.cd(path); ftpClient.binary(); TelnetInputStream is=ftpClient.get(filename); File file_out=new File(filename); FileOutputStream os=new FileOutputStream(file_out); byte[] bytes=new byte[1024]; int c; while ((c=is.read(bytes))!=-1) { os.write(bytes,0,c); } is.close(); os.close(); ftpClient.closeServer(); } catch (IOException ex) {;} } (3)向FTP服务器上上传一个文件 void putButton_actionPerformed(ActionEvent e) { String server=serverEdit.getText(); String user=userEdit.getText(); String password=passwordEdit.getText(); String path=pathEdit.getText(); String filename=filenameEdit.getText(); try { FtpClient ftpClient=new FtpClient(); ftpClient.openServer(server); ftpClient.login(user, password); if (path.length()!=0) ftpClient.cd(path); ftpClient.binary(); TelnetOutputStream os=ftpClient.put(filename); File file_in=new File(filename); FileInputStream is=new FileInputStream(file_in); byte[] bytes=new byte[1024]; int c; while ((c=is.read(bytes))!=-1){ os.write(bytes,0,c);} is.close(); os.close(); ftpClient.closeServer(); } catch (IOException ex) {;} } }
