Z
zzlyx
Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个文件上传软件,在WINDOW下的FTP服务器都能正常上传并修改名字
但是如果上传到LINUX下的FTP 服务器时,可以正常上传,但当传完成时,修改名称时会提示出错。上传的程序如下:
Result := False;
try
InUploadData := True;
if RemoteFileName = '' then RemoteFileName := ExtractFileName(FullFileName +'.txt');
IdFTP.Host := FTPServer;
IdFTP.Username := FTPUser;
IdFTP.Password := FTPPass;
if IdFTP.Connected then IdFTP.Disconnect;
IdFTP.Connect;
IdFTP.ChangeDir(FTPDir);
IdFTP.TransferType := ftBinary;
if CreateTempFile='1' then
begin
IdFTP.Put(FullFileName +'.txt', RemoteFileName + '.TMP');
try
IdFTP.Rename(IdFTP.RetrieveCurrentDir + '/'+ RemoteFileName + '.TMP', RemoteFileName +'.ITF' );
except
on E: Exception do
begin
LcyErrLog('FTP', '服务器将*.TMP修改为*.ITF出错', E.Message);
PutToDebugLog('服务器将*.TMP修改为*.ITF出错'+E.Message);
end;
end ;
end
else
begin
IdFTP.Put(FullFileName +'.txt', RemoteFileName + '.ITF');
end;
IdFTP.Put(FullFileName +'.CHK', RemoteFileName + '.CHK');
IdFTP.Disconnect;
BackupFile(FullFileName+'.txt', BackupPath); //移动文件
BackupFile(FullFileName+'.CHK', BackupPath); //移动文件
IdFTP.Disconnect;
Result := True;
except
on E: Exception do
LcyErrLog('FTP', '上传数据出错', E.Message);
end;
,请各位相互交流一下。
但是如果上传到LINUX下的FTP 服务器时,可以正常上传,但当传完成时,修改名称时会提示出错。上传的程序如下:
Result := False;
try
InUploadData := True;
if RemoteFileName = '' then RemoteFileName := ExtractFileName(FullFileName +'.txt');
IdFTP.Host := FTPServer;
IdFTP.Username := FTPUser;
IdFTP.Password := FTPPass;
if IdFTP.Connected then IdFTP.Disconnect;
IdFTP.Connect;
IdFTP.ChangeDir(FTPDir);
IdFTP.TransferType := ftBinary;
if CreateTempFile='1' then
begin
IdFTP.Put(FullFileName +'.txt', RemoteFileName + '.TMP');
try
IdFTP.Rename(IdFTP.RetrieveCurrentDir + '/'+ RemoteFileName + '.TMP', RemoteFileName +'.ITF' );
except
on E: Exception do
begin
LcyErrLog('FTP', '服务器将*.TMP修改为*.ITF出错', E.Message);
PutToDebugLog('服务器将*.TMP修改为*.ITF出错'+E.Message);
end;
end ;
end
else
begin
IdFTP.Put(FullFileName +'.txt', RemoteFileName + '.ITF');
end;
IdFTP.Put(FullFileName +'.CHK', RemoteFileName + '.CHK');
IdFTP.Disconnect;
BackupFile(FullFileName+'.txt', BackupPath); //移动文件
BackupFile(FullFileName+'.CHK', BackupPath); //移动文件
IdFTP.Disconnect;
Result := True;
except
on E: Exception do
LcyErrLog('FTP', '上传数据出错', E.Message);
end;
,请各位相互交流一下。