When uploading an FTP file, if the file already exists in the remote FTP, but you do not want to resume the file (because the file is found to be a document, after modification, the document may fail during the resume, for example, if you want to delete files from ftp, the following error is always reported.
220 Microsoft FTP service
User test1
331 Password required for test1.
Pass 123
230 user logged in.
Connection successful: 192.168.3.17-21-test1-123
Type I
200 type set to I.
CWD/download/fs/
250 CWD command successful.
Syst
215 windows_nt
PASV
227 entering passive mode (192,168, 210,152 ).
List ???? 20120627. txt
125 data connection already open; transfer starting.
226 transfer complete.
Ftpconfig. getuploadusefrombreak (): n-this is printed by myself.
Dele: 20120627.txt
550-the filename, directory name, or volume label syntax is incorrect.
Win32 error: the filename, directory name, or volume label syntax is incorrect.
Error details: file system returned an error.
550 end
Upload File status: delete_remote_faild-this is printed by myself
Failed to search on the Internet,
At last, I saw an error with Chinese garbled characters. I tried to change some of the Code.
// Boolean dsuccess = ftpclient. deletefile (remotefilename) the path here should be full path remotesystem. out. println (Remote + "-- remote"); Boolean dsuccess = ftpclient. deletefile (new string (remote. getbytes ("gb2312", "iso-8859-1"); If (! Dsuccess) {system. out. println ("An error occurred while deleting the FTP file, probably because the path encoding is incorrect. Now path encoding conversion" + gb2312); Return uploadstatus. delete_remote_faild;} else {system. out. println ("FTP Old File deleted successfully:" + remotefilename );}
As shown above, only file path transcoding is added. It can be changed to gb2312.
This article Reprinted from http://www.zhqhlbt.com /? P = 55 If You Need To reprint it, please write the link