how to leave a folder set to when to save? and a folder set to open files?

-2

I would like to lock folders, so that I could not fetch files or save files in other folders, just those defined, folders EX: c:\banco_de_dados and another call c:\FTP_Servidor

In case it would be to leave the set path to send the database to the server automatically.

part of the source:

begin

if OpenDialog1.Execute then
if SaveDialog1.Execute then

idftp1.Put(OpenDialog1.FileName, '/projeto_ftp/banco/' + ExtractFileName(SaveDialog1.FileName));

  // ShowMessage('Transferido');

idftp1.Get(SaveDialog1.FileName, '/projeto_ftp/' );
    
asked by anonymous 10.10.2018 / 14:59

1 answer

0

You can validate the path after the person selects the file, 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;
    
10.10.2018 / 16:54