try
IdFTP1. Passive:=True;
If not IdFTP1. Connected then IdFTP1. Connect;
IdFTP1. IOHandler. DefStringEncoding:=IndyTextEncoding (TEncoding. Default);
If IdFTP1. RetrieveCurrentDir & lt;> '/' then IdFTP1. ChangeDir ('/');
IdFTP1. ChangeDir (ChangeFileExt (ExtractFileName (Application. ExeName), "));
IdFTP1. ChangeDir (' Attachment ');
IdFTP1. ChangeDir (Self. The Caption);
Try
IdFTP1. ChangeDir (EditCode. Text);
Except,
IdFTP1. MakeDir (EditCode. Text);
IdFTP1. ChangeDir (EditCode. Text);
The end;
//IdFTP1. TransferType:=ftASCII;
With OpenDialog1 do
The begin
Title:='open the path to the file;//set the browse dialog title name
Options:=[ofAllowMultiSelect];
If the Execute then
The begin
For I:=0 to Files. Do the Count - 1
The begin
Tb_attachment. Append;
Tb_attachment. FieldByName (' the name of the attachment). AsString:=ExtractFileName (Files [I]);
Tb_attachment. FieldByName (' descendants on) AsString:=Tb_User. FieldByName (' user name '). AsString;
Tb_attachment. FieldByName (' upload time) AsString:=FormatDateTime (' MM - dd yyyy - HH: MM: ss ', Now);
The end;
MSQL:=DeltaToSQLDetailsTable (Tb_attachment, 'information measurement accessories',' ID ', 'ID' AKeyFields, EditCode. The Text).
MRet:=AppSrv ExecSQL (mSQL);
If mRet=1 then
The begin
For I:=0 to Files. Do the Count - 1
The begin
//Put failure
IdFTP1. Put (Files [I], AnsiToUtf8 (ExtractFileName (Files [I])));
The end;
AKeyFields mSQL:=mSQLstr02 + 'WHERE' + + '=' + QuotedStr (EditCode. Text) + OrderBySQL;
AppSrv. OpenSQL (mSQL Tb_attachment);
Dlg_ShowHint (' upload success! ');
End
The else
The begin
Dlg_ShowError (Read_ErrorMsg (mRet) that ramps up existing targets + 'upload failed! ');
The end;
The end;
The end;
Except,
On E: the Exception do
Dlg_ShowError (E.M essage + 'upload failed! ');
The end;
CodePudding user response:
Passive need according to your server Settings to handle, you change to the choice of dynamic configuration him, and modify IP to get together,