You can validate the path after the person select the file in this way
OpenDialog1.initialDir := 'C:\Seu\caminho\busca\';
SaveDialog1.initialDir := 'C:\Seu\caminho\salvar\';
if(OpenDialog1.Execute)then
begin
if(ExtractFilePath(OpenDialog1.FileName) = 'C:\Seu\caminho\busca\')then
begin
if(SaveDialog1.Execute)then
begin
if(ExtractFilePath(SaveDialog1.FileName) <> 'C:\Seu\caminho\salvar\')then
begin
idftp1.Put(OpenDialog1.FileName, '/projeto_ftp/banco/' + ExtractFileName(SaveDialog1.FileName));
// ShowMessage('Transferido');
idftp1.Get(SaveDialog1.FileName, '/projeto_ftp/' );
end;
end;
end;
end;
In order to be invisible to the customer, you would have to set the paths in the source manually without the option of it being able to select...
An example would be like this:
procedure SeuMetodo();
var
cCaminhoSalvar: String;
cCaminhoServidor: String;
cCaminhoArquivo: String;
begin
cCaminhoSalvar := 'C:\Seu\caminho\salvar\';
cCaminhoServidor := 'servidor\arquivos';
cCaminhoArquivo := 'C:\Seu\caminho\busca\arquivoTal.bd'; {Aqui teria que tratar o nome do arquivo, caso exista mais de um na pasta}
idftp1.Put(cCaminhoArquivo, cCaminhoServidor + ExtractFileName(cCaminhoArquivo));
// ShowMessage('Transferido');
idftp1.Get(cCaminhoSalvar, cCaminhoServidor);
end;
(*Não lembro a ordem correta dos parâmetros do PUT e GET*)
Note: To automate your application, you could create a service for it and within the service use a thread with a counter inside it and then, for example, every 1hr it makes the necessary validations and sends your data.
You could set the path fixed at your source... But without seeing your source it is difficult to help, if you can change your question and put a snippet of your source from where you want to do this "lock".
– Matheus Ribeiro
@Matheus Ribeiro put the excerpt I’m using for this part, thanks for noticing, I really forgot to put the font there. Thanks
– Ronaldo Power