導航:首頁 > 編程語言 > java代碼實現ftp上傳

java代碼實現ftp上傳

發布時間:2025-08-01 01:18:32

⑴ 從java文件到FTP有幾種方法(2)

在Java編程中,實現文件到FTP傳輸的方法多種多樣。以下是一種基於FTP協議的實現示例:

首先,我們需要構建一個FTP連接。示例代碼展示了如何通過指定伺服器地址和埠號來建立連接:

java
public Socket connect(String serverAddr, int port) throws IOException {
Socket socket = null;
String responseStr = "";
String[] responseArray;
int location;
int n, m;

try {
socket = new Socket(serverAddr, port);
responseStr = this.getResponseString();
location = responseStr.lastIndexOf(", ");
n = Integer.parseInt(responseStr.substring(location + 1, responseStr.indexOf(" )")));
responseStr = responseStr.substring(0, location);
location = responseStr.lastIndexOf(", ");
m = Integer.parseInt(responseStr.substring(location + 1, responseStr.length()));
socket = new Socket(serverAddr, m * 256 + n);
} catch (FTPProtocolException e) {
throw e;
}
if (issueCommand(s) == FTP_ERROR) {
MyFtpProtocolException ftpprotocolexception1 = new MyFtpProtocolException(s);
throw ftpprotocolexception1;
}
return socket;
}

當需要關閉FTP連接時,只需調用`closeServer()`方法即可:

java
public void closeServer() throws IOException {
socket.close();
socket = null;
super.closeServer();
}

如果需要打開與FTP伺服器的連接,可以通過`openServer(String s, int i)`方法指定伺服器地址和埠號:

java
public void openServer(String s, int i) throws IOException {
super.openServer(s, i);
serverAddr = s;
}

此外,還定義了一個自定義的FTP異常類`MyFtpProtocolException`來處理特定的協議錯誤:

java
class MyFtpProtocolException extends IOException {
MyFtpProtocolException(String s) {
super(s);
}
}

在Struts框架中,查看文件內容的功能則依賴於Web應用程序的`ServletContext`對象。每個Web應用程序都有一個獨立的Servlet容器,且包含一個`ServletContext`對象,可通過`ServletConfig.getServletContext()`方法獲取。`ServletContext`對象用於存儲與整個Web應用程序相關的配置信息。

獲取資源路徑的方法是`getResourcePath()`,它返回一個包含目錄和文件路徑名稱的Set集合。

要獲取資源上的URL對象,可以使用`getResource()`方法。

若要獲取與資源連接的`InputStream`對象,可以調用`getResourceAsStream()`方法。在這個過程中,如果需要進行字元處理,還需要使用`InputStreamReader`進行包裝:

java
InputStreamReader inputReader = new InputStreamReader(input);

以上代碼和方法展示了如何在Java中實現文件到FTP的傳輸以及在Struts中查看文件內容的基本操作。

⑵ java如何實現將FTP文件轉移到另一個FTP伺服器上

你有FTPClient就比較好辦,假如你的兩台FTP伺服器分別為fs1和fs2

在本地開發代碼思路如下內:

  1. 通過FTPClient連接上容fs1,然後下載(可以循環批量下載)到本地伺服器,保存到一個臨時目錄。

  2. 下載完成後,FTPClient斷開與fs1的連接,記得必須logout。

  3. 本地伺服器通過FileInputStream將剛下載到臨時目錄的文件讀進來,得到一個List<File>集合。

  4. 通過FTPClient連接上fs2,循環List<File>集合,將文件上傳至fs2的特定目錄,然後清空臨時目錄,上傳完畢後,斷開fs2的連接,同樣必須logout。

⑶ 鍏鍙歌佹眰鍋氫竴涓猨ava鍜宩sp鎬庝箞瀹炵幇ftp涓婁紶鐨勫姛鑳芥ā鍧楋紝鎴戞病鏈夊仛榪囷紝璋佹湁璁插緱緇嗕竴鐐圭殑鏂囩珷鎴栫綉絝欍

form琛ㄥ崟鎻愪氦鏂囦歡錛屽緩璁鐢╯martupload涓婁紶錛屾殏瀛樺湪web鏈嶅姟鍣ㄧ洰褰曚笅錛岀劧鍚庣◢寰涓涓嬩笅闈㈢殑浠g爜錛宖tp涓婁紶鍚庯紝鍒犻櫎鏆傚瓨鏂囦歡錛宱k
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.StringTokenizer;

import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.log4j.Logger;

/**
* Ftp 鏈嶅姟綾伙紝瀵笰pache鐨刢ommons.net.ftp榪涜屼簡鍖呰<br>
* 渚濊禆搴撴枃浠訛細commons-net-1.4.1.jar
*
* @version 1.0 2008-02-18
* @author huchao@jbsoft
*/
public class FtpService {

public FtpService(String serverAddr, String lsenport, String userName,
String pswd) {
this.ftpServerAddress = serverAddr;
this.port = Integer.parseInt(lsenport);
this.user = userName;
this.password = pswd;
}

/**
* FTP 鏈嶅姟鍣ㄥ湴鍧
*/
private String ftpServerAddress = null;
/**
* FTP 鏈嶅姟絝鍙
*/
private int port = 21;
/**
* FTP 鐢ㄦ埛鍚
*/
private String user = null;
/**
* FTP 瀵嗙爜
*/
private String password = null;
/**
* FTP 鏁版嵁浼犺緭瓚呮椂鏃墮棿
*/
private int timeout = 0;
/**
* 寮傚父錛氱櫥褰曞け璐
*/
private final I2HFException EXCEPTION_LOGIN = new I2HFException("COR101",
"FTP鏈嶅姟鍣ㄧ櫥褰曞け璐");
/**
* 寮傚父錛氭枃浠朵紶杈撳け璐
*/
private final I2HFException EXCEPTION_FILE_TRANSFER = new I2HFException(
"COR010", "FTP鏂囦歡浼犺緭澶辮觸");
/**
* 寮傚父錛欼O寮傚父
*/
private final I2HFException EXCEPTION_GENERAL = new I2HFException("COR010",
"FTP IO 寮傚父");
private static final Logger logger = Logger.getLogger(FtpService.class);

/**
* 鍒濆嬪寲FTP榪炴帴錛屽苟榪涜岀敤鎴風櫥褰
*
* @return FTPClient
* @throws I2HFException
*/
public FTPClient initConnection() throws I2HFException {
FTPClient ftp = new FTPClient();
try {
// 榪炴帴鍒癋TP
ftp.connect(ftpServerAddress, port);
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
throw new I2HFException("COR010", "FTP鏈嶅姟鍣ㄨ繛鎺ュけ璐");
}
// 鐧誨綍
if (!ftp.login(user, password)) {
throw EXCEPTION_LOGIN;
}
// 浼犺緭妯″紡浣跨敤passive
ftp.enterLocalPassiveMode();
// 璁劇疆鏁版嵁浼犺緭瓚呮椂鏃墮棿
ftp.setDataTimeout(timeout);
logger.info("FTP鏈嶅姟鍣╗" + ftpServerAddress + " : " + port + "]鐧誨綍鎴愬姛");
} catch (I2HFException te) {
logger.info(te.errorMessage, te);
throw te;
} catch (IOException ioe) {
logger.info(ioe.getMessage(), ioe);
throw EXCEPTION_LOGIN;
}
return ftp;
}

/**
* 璁劇疆浼犺緭鏂瑰紡
*
* @param ftp
* @param binaryFile
* true:浜岃繘鍒/false:ASCII
* @throws I2HFException
*/
public void setTransferMode(FTPClient ftp, boolean binaryFile)
throws I2HFException {
try {
if (binaryFile) {
ftp.setFileType(FTP.BINARY_FILE_TYPE);
logger.info("FTP鏂囦歡浼犺緭鏂瑰紡涓猴細浜岃繘鍒");
} else {
ftp.setFileType(FTP.ASCII_FILE_TYPE);
logger.info("FTP鏂囦歡浼犺緭鏂瑰紡涓猴細ASCII");
}
} catch (IOException ex) {
logger.info(ex.getMessage(), ex);
throw EXCEPTION_GENERAL;
}
}

/**
* 鍦ㄥ綋鍓嶅伐浣滅洰褰曚笅寤虹珛澶氱駭鐩褰曠粨鏋
*
* @param ftp
* @param dir
* @throws I2HFException
*/
public void makeMultiDirectory(FTPClient ftp, String dir)
throws I2HFException {
try {
StringBuffer fullDirectory = new StringBuffer();
StringTokenizer toke = new StringTokenizer(dir, "/");
while (toke.hasMoreElements()) {
String currentDirectory = (String) toke.nextElement();
fullDirectory.append(currentDirectory);
ftp.makeDirectory(fullDirectory.toString());
if (toke.hasMoreElements()) {
fullDirectory.append('/');
}
}
} catch (IOException ex) {
logger.info(ex.getMessage(), ex);
throw EXCEPTION_GENERAL;
}
}

/**
* 鏇存敼鏈嶅姟鍣ㄥ綋鍓嶈礬寰
*
* @param ftp
* @param dir
* @throws I2HFException
*/
public void changeWorkingDirectory(FTPClient ftp, String dir)
throws I2HFException {
try {
if (!ftp.changeWorkingDirectory(dir)) {
throw new I2HFException("COR010", "鐩褰昜 " + dir + "]榪涘叆澶辮觸");
}
} catch (I2HFException tfe) {
logger.info(tfe.errorMessage, tfe);
throw tfe;
} catch (IOException ioe) {
logger.info(ioe.getMessage(), ioe);
throw EXCEPTION_GENERAL;
}
}

/**
* 涓婁紶鏂囦歡鍒癋TP鏈嶅姟鍣
*
* @param ftp
* @param localFilePathName
* @param remoteFilePathName
* @throws I2HFException
*/
public void uploadFile(FTPClient ftp, String localFilePathName,
String remoteFilePathName) throws I2HFException {
InputStream input = null;
try {
input = new FileInputStream(localFilePathName);
boolean result = ftp.storeFile(remoteFilePathName, input);
if (!result) {
// 鏂囦歡涓婁紶澶辮觸
throw EXCEPTION_FILE_TRANSFER;
}
logger.info("鏂囦歡鎴愬姛涓婁紶鍒癋TP鏈嶅姟鍣");
} catch (I2HFException tfe) {
logger.info(tfe.getMessage(), tfe);
throw tfe;
} catch (IOException ioe) {
logger.info(ioe.getMessage(), ioe);
throw EXCEPTION_FILE_TRANSFER;
} finally {
try {
if (input != null) {
input.close();
}
} catch (IOException ex) {
logger.info("FTP瀵硅薄鍏抽棴寮傚父", ex);
}
}
}

/**
* 涓嬭澆鏂囦歡鍒版湰鍦
*
* @param ftp
* @param remoteFilePathName
* @param localFilePathName
* @throws I2HFException
*/
public void downloadFile(FTPClient ftp, String remoteFilePathName,
String localFilePathName) throws I2HFException {
boolean downloadResult = false;
OutputStream output = null;
try {
output = new FileOutputStream(localFilePathName);
downloadResult = ftp.retrieveFile(remoteFilePathName, output);
if (!downloadResult) {
// 濡傛灉鏄鏂囦歡涓嶅瓨鍦ㄥ皢寮傚父鎶涘嚭
throw new I2HFException("COR011", "鏂囦歡涓嶅瓨鍦");
}
logger.info("鏂囦歡鎴愬姛浠嶧TP鏈嶅姟鍣ㄤ笅杞");
} catch (I2HFException tfe) {
logger.error(tfe.getMessage(), tfe);
throw tfe;
} catch (IOException ex) {
logger.error(ex.getMessage(), ex);
throw EXCEPTION_FILE_TRANSFER;
} finally {
try {
if (output != null) {
output.close();
}
if (!downloadResult) {
new File(localFilePathName).delete();
}
} catch (IOException ex) {
logger.error("FTP瀵硅薄鍏抽棴寮傚父", ex);
}
}
}

/**
* Method setFtpServerAddress.
*
* @param ftpServerAddress
* String
*/
public void setFtpServerAddress(String ftpServerAddress) {
this.ftpServerAddress = ftpServerAddress;
}

/**
* Method setUser.
*
* @param user
* String
*/
public void setUser(String user) {
this.user = user;
}

/**
* Method setPassword.
*
* @param password
* String
*/
public void setPassword(String password) {
this.password = password;
}

/**
* Method setTimeout.
*
* @param timeout
* String
*/
public void setTimeout(String timeout) {
try {
this.timeout = Integer.parseInt(timeout);
} catch (NumberFormatException ex) {
// 榛樿よ秴鏃舵椂闂500姣縐
this.timeout = 500;
}
}

/**
* Method setPort.
*
* @param port
* String
*/
public void setPort(String port) {
try {
this.port = Integer.parseInt(port);
} catch (NumberFormatException ex) {
// 榛樿ょ鍙21
this.port = 21;
}
}
}
=====================================
jsp涓婁紶閮ㄥ垎
===================================
<form method="post" name="uploadform" id="uploadform" action="upload" ENCTYPE="multipart/form-data">

<input type="hidden" name="service" value="com.jbsoft.i2hf.corpor.services.CstBatchBizServices.exclUpload"/>
<table cellspacing="0" cellpadding="0">
<tr>
<td width="20%" align="right">涓婁紶鏈鍦版枃浠訛細</td>
<td width="80%"><input class="" style="width:300px" type="file" width="300px" name="exclname" id="exclname"/></td>
</tr>
</table>
</form>
============================================
涓婁紶鐨剆ervlet鐢ㄧ殑鏄痵martupload
錛岄儴鍒嗕唬鐮佸彲浠ュ弬鑰冧竴涓嬶細
==========================================
SmartUpload su = new SmartUpload();
su.setCharset("UTF-8");
su.initialize(getServletConfig(), request, response);
su.setMaxFileSize(10240000);
su.setTotalMaxFileSize(102400000);
su.setAllowedFilesList("xls");
su.upload();
===========================================
浠g爜閲岄潰鏈変竴浜涘㈡埛鐨勪俊鎮錛屼笉鑳藉叏閮ㄧ粰浣犲搱

⑷ java 實現ftp上傳如何創建文件夾

這個功能我也剛寫完,不過我也是得益於同行,現在我也把自己的分享給大家,希望能對大家有所幫助,因為自己的項目不涉及到創建文件夾,也僅作分享,不喜勿噴謝謝!

interface:
packagecom.sunline.bank.ftputil;

importjava.io.BufferedInputStream;
importjava.io.BufferedOutputStream;
importorg.apache.commons.net.ftp.FTPClient;

publicinterfaceIFtpUtils{
/**
*ftp登錄
*@paramhostname主機名
*@paramport埠號
*@paramusername用戶名
*@parampassword密碼
*@return
*/
publicFTPClientloginFtp(Stringhostname,Integerport,Stringusername,Stringpassword);
/**
*上穿文件
*@paramhostname主機名
*@paramport埠號
*@paramusername用戶名
*@parampassword密碼
*@paramfpathftp路徑
*@paramlocalpath本地路徑
*@paramfileName文件名
*@return
*/
(Stringhostname,Integerport,Stringusername,Stringpassword,Stringfpath,Stringlocalpath,StringfileName);
/**
*批量下載文件
*@paramhostname
*@paramport
*@paramusername
*@parampassword
*@paramfpath
*@paramlocalpath
*@paramfileName源文件名
*@paramfilenames需要修改成的文件名
*@return
*/
publicbooleandownloadFileList(Stringhostname,Integerport,Stringusername,Stringpassword,Stringfpath,Stringlocalpath,StringfileName,Stringfilenames);
/**
*修改文件名
*@paramlocalpath
*@paramfileName源文件名
*@paramfilenames需要修改的文件名
*/
(Stringlocalpath,StringfileName,Stringfilenames);
/**
*關閉流連接、ftp連接
*@paramftpClient
*@parambufferRead
*@parambuffer
*/
publicvoidcloseFtpConnection(FTPClientftpClient,,BufferedInputStreambuffer);
}

impl:
packagecom.sunline.bank.ftputil;

importjava.io.BufferedInputStream;
importjava.io.BufferedOutputStream;
importjava.io.File;
importjava.io.FileInputStream;
importjava.io.FileOutputStream;
importjava.io.IOException;
importorg.apache.commons.net.ftp.FTPClient;
importorg.apache.commons.net.ftp.FTPFile;
importorg.apache.commons.net.ftp.FTPReply;
importcommon.Logger;

{
privatestaticLoggerlog=Logger.getLogger(FtpUtilsImpl.class);
FTPClientftpClient=null;
Integerreply=null;

@Override
publicFTPClientloginFtp(Stringhostname,Integerport,Stringusername,Stringpassword){
ftpClient=newFTPClient();
try{
ftpClient.connect(hostname,port);
ftpClient.login(username,password);
ftpClient.setControlEncoding("utf-8");
reply=ftpClient.getReplyCode();
ftpClient.setDataTimeout(60000);
ftpClient.setConnectTimeout(60000);
//設置文件類型為二進制(避免解壓縮文件失敗)
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
//開通數據埠傳輸數據,避免阻塞
ftpClient.enterLocalActiveMode();
if(!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())){
log.error("連接FTP失敗,用戶名或密碼錯誤");
}else{
log.info("FTP連接成功");
}
}catch(Exceptione){
if(!FTPReply.isPositiveCompletion(reply)){
try{
ftpClient.disconnect();
}catch(IOExceptione1){
log.error("登錄FTP失敗,請檢查FTP相關配置信息是否正確",e1);
}
}
}
returnftpClient;
}

@Override
@SuppressWarnings("resource")
(Stringhostname,Integerport,Stringusername,Stringpassword,Stringfpath,Stringlocalpath,StringfileName){
booleanflag=false;
ftpClient=loginFtp(hostname,port,username,password);
BufferedInputStreambuffer=null;
try{
buffer=newBufferedInputStream(newFileInputStream(localpath+fileName));
ftpClient.changeWorkingDirectory(fpath);
fileName=newString(fileName.getBytes("utf-8"),ftpClient.DEFAULT_CONTROL_ENCODING);
if(!ftpClient.storeFile(fileName,buffer)){
log.error("上傳失敗");
returnflag;
}
buffer.close();
ftpClient.logout();
flag=true;
returnflag;
}catch(Exceptione){
e.printStackTrace();
}finally{
closeFtpConnection(ftpClient,null,buffer);
log.info("文件上傳成功");
}
returnfalse;
}

@Override
publicbooleandownloadFileList(Stringhostname,Integerport,Stringusername,Stringpassword,Stringfpath,Stringlocalpath,StringfileName,Stringfilenames){
ftpClient=loginFtp(hostname,port,username,password);
booleanflag=false;
=null;
if(fpath.startsWith("/")&&fpath.endsWith("/")){
try{
//切換到當前目錄
this.ftpClient.changeWorkingDirectory(fpath);
this.ftpClient.enterLocalActiveMode();
FTPFile[]ftpFiles=this.ftpClient.listFiles();
for(FTPFilefiles:ftpFiles){
if(files.isFile()){
System.out.println("=================="+files.getName());
FilelocalFile=newFile(localpath+"/"+files.getName());
bufferRead=newBufferedOutputStream(newFileOutputStream(localFile));
ftpClient.retrieveFile(files.getName(),bufferRead);
bufferRead.flush();
}
}
ftpClient.logout();
flag=true;

}catch(IOExceptione){
e.printStackTrace();
}finally{
closeFtpConnection(ftpClient,bufferRead,null);
log.info("文件下載成功");
}
}
modifiedLocalFileName(localpath,fileName,filenames);
returnflag;
}

@Override
(Stringlocalpath,StringfileName,Stringfilenames){
Filefile=newFile(localpath);
File[]fileList=file.listFiles();
if(file.exists()){
if(null==fileList||fileList.length==0){
log.error("文件夾是空的");
}else{
for(Filedata:fileList){
Stringorprefix=data.getName().substring(0,data.getName().lastIndexOf("."));
Stringprefix=fileName.substring(0,fileName.lastIndexOf("."));
System.out.println("index==="+orprefix+"prefix==="+prefix);
if(orprefix.contains(prefix)){
booleanf=data.renameTo(newFile(localpath+"/"+filenames));
System.out.println("f============="+f);
}else{
log.error("需要重命名的文件不存在,請檢查。。。");
}
}
}
}
}


@Override
publicvoidcloseFtpConnection(FTPClientftpClient,,BufferedInputStreambuffer){
if(ftpClient.isConnected()){
try{
ftpClient.disconnect();
}catch(IOExceptione){
e.printStackTrace();
}
}
if(null!=bufferRead){
try{
bufferRead.close();
}catch(IOExceptione){
e.printStackTrace();
}
}
if(null!=buffer){
try{
buffer.close();
}catch(IOExceptione){
e.printStackTrace();
}
}
}


publicstaticvoidmain(String[]args)throwsIOException{
Stringhostname="xx.xxx.x.xxx";
Integerport=21;
Stringusername="edwftp";
Stringpassword="edwftp";
Stringfpath="/etl/etldata/back/";
StringlocalPath="C:/Users/Administrator/Desktop/ftp下載/";
StringfileName="test.txt";
Stringfilenames="ok.txt";
FtpUtilsImplftp=newFtpUtilsImpl();
/*ftp.modifiedLocalFileName(localPath,fileName,filenames);*/
ftp.downloadFileList(hostname,port,username,password,fpath,localPath,fileName,filenames);
/*ftp.uploadLocalFilesToFtp(hostname,port,username,password,fpath,localPath,fileName);*/
/*ftp.modifiedLocalFileName(localPath);*/
}
}

⑸ 求用java寫一個ftp伺服器客戶端程序。

import java.io.*;
import java.net.*;public class ftpServer extends Thread{ public static void main(String args[]){
String initDir;
initDir = "D:/Ftp";
ServerSocket server;
Socket socket;
String s;
String user;
String password;
user = "root";
password = "123456";
try{
System.out.println("MYFTP伺服器啟動....");
System.out.println("正在等待連接....");
//監聽21號埠
server = new ServerSocket(21);
socket = server.accept();
System.out.println("連接成功");
System.out.println("**********************************");
System.out.println("");

InputStream in =socket.getInputStream();
OutputStream out = socket.getOutputStream();

DataInputStream din = new DataInputStream(in);
DataOutputStream dout=new DataOutputStream(out);
System.out.println("請等待驗證客戶信息....");

while(true){
s = din.readUTF();
if(s.trim().equals("LOGIN "+user)){
s = "請輸入密碼:";
dout.writeUTF(s);
s = din.readUTF();
if(s.trim().equals(password)){
s = "連接成功。";
dout.writeUTF(s);
break;
}
else{s ="密碼錯誤,請重新輸入用戶名:";<br> dout.writeUTF(s);<br> <br> }
}
else{
s = "您輸入的命令不正確或此用戶不存在,請重新輸入:";
dout.writeUTF(s);
}
}
System.out.println("驗證客戶信息完畢...."); while(true){
System.out.println("");
System.out.println("");
s = din.readUTF();
if(s.trim().equals("DIR")){
String output = "";
File file = new File(initDir);
String[] dirStructure = new String[10];
dirStructure= file.list();
for(int i=0;i<dirStructure.length;i++){
output +=dirStructure[i]+"\n";
}
s=output;
dout.writeUTF(s);
}
else if(s.startsWith("GET")){
s = s.substring(3);
s = s.trim();
File file = new File(initDir);
String[] dirStructure = new String[10];
dirStructure= file.list();
String e= s;
int i=0;
s ="不存在";
while(true){
if(e.equals(dirStructure[i])){
s="存在";
dout.writeUTF(s);
RandomAccessFile outFile = new RandomAccessFile(initDir+"/"+e,"r");
byte byteBuffer[]= new byte[1024];
int amount;
while((amount = outFile.read(byteBuffer)) != -1){
dout.write(byteBuffer, 0, amount);break;
}break;

}
else if(i<dirStructure.length-1){
i++;
}
else{
dout.writeUTF(s);
break;
}
}
}
else if(s.startsWith("PUT")){
s = s.substring(3);
s = s.trim();
RandomAccessFile inFile = new RandomAccessFile(initDir+"/"+s,"rw");
byte byteBuffer[] = new byte[1024];
int amount;
while((amount =din.read(byteBuffer) )!= -1){
inFile.write(byteBuffer, 0, amount);break;
}
}
else if(s.trim().equals("BYE"))break;
else{
s = "您輸入的命令不正確或此用戶不存在,請重新輸入:";
dout.writeUTF(s);
}
}

din.close();
dout.close();
in.close();
out.close();
socket.close();
}
catch(Exception e){
System.out.println("MYFTP關閉!"+e);

}
}}

閱讀全文

與java代碼實現ftp上傳相關的資料

熱點內容
五軸數控編程軟體哪個最好 瀏覽:295
快手app如何登錄多個賬號 瀏覽:70
什麼網站可以下載漫畫 瀏覽:145
ipad批註哪個app好用免費 瀏覽:378
文件的名字由文件名和什麼組成 瀏覽:708
穿越時空的思念所有版本 瀏覽:196
游戲編程學什麼課程 瀏覽:540
access中如何表示指定數據 瀏覽:315
net映射文件下載 瀏覽:59
商務辦公教程 瀏覽:800
oracle導出dmp文件linux 瀏覽:582
盲目崇拜蘋果手機 瀏覽:429
戰地2音頻文件路徑 瀏覽:526
怎麼用手機恢復網站 瀏覽:653
淘寶一樣的app單商戶 瀏覽:111
下載津心辦app有什麼用 瀏覽:268
陌陌升級方法 瀏覽:132
四輪定位哪個數據影響吃胎 瀏覽:1
怎麼清楚cad中lsp文件 瀏覽:358
qq收藏文件找出來無法打開怎麼辦 瀏覽:913

友情鏈接