वापस आएं कृपया इसे समझें। कोड बिना किसी अपवाद के ठीक से चलता है।FtpClient storeFile हमेशा झूठी
FTPClient ftp = new FTPClient();
ftp.connect(server);
if(!ftp.login(username, password))
{
ftp.logout();
return false;
}
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply))
{
ftp.disconnect();
return false;
}
InputStream in = new FileInputStream(localfile);
ftp.setFileType(ftp.BINARY_FILE_TYPE, ftp.BINARY_FILE_TYPE);
ftp.setFileTransferMode(ftp.BINARY_FILE_TYPE);
Store = ftp.storeFile(destinationfile, in);
in.close();
ftp.logout();
ftp.disconnect();
}
catch (Exception ex)
{
ex.printStackTrace();
return false;
}
return Store;
Buttttttttt
वापसी कथन हमेशा अवास्तविक लौटाते और फ़ाइल सर्वर पर अपलोड नहीं किया है। कृपया कोई इस पर मदद करें।
आपकी जानकारी के लिए, 1) मैं एक ऑफिस नेटवर्क में हूं। ---> क्या हमें कोई प्रॉक्सी जोड़ने की ज़रूरत है?
File file = new File("C:\\Users\\sg0214273\\Desktop\\seagate\\seagate.txt");
FileInputStream input = new FileInputStream(file);
client.setFileType(FTP.BINARY_FILE_TYPE);
if (!client.storeFile(file.getName(), input)) {
System.out.println("upload failed!");
}
reply = client.getReplyCode();
if(!FTPReply.isPositiveCompletion(reply)) {
System.out.println("upload failed!");
}
Login success...
230 User ******** logged in.
upload failed!-----> is form boolean return value of storefile
upload failed!---------> is from replycode...
Logout from FTP server...
कृपया मदद
ftp.getReplyCode() वापस क्या करता है? Ftp.storeFile के बाद? –
@ ग्रे नंबर।पहली वाक्य को देखें –