Search code examples
delphiftpindyindy10

How to set download location for ftp.get with Indy Delphi component


I can successfully download a file from my ftp server using:

ftp.get(chosenFile,chosenFile);

Where chosenFile is simply a string with the name of the file.

However these are downloaded to the Debug folder of my Delphi project so...

1.) How can I specify where the files should be downloaded to. 2.) How can I make TOpenDialog automatically open to that location after downloading?


Solution

  • [SOLVED] I solved my own problem, can't believe it was so simple: 1.Specify the director where the file should be downloaded to as the second parameter: ftp.get(chosenFile,'C:\Temp\'+chosenFile); 2.Set the initial directory of the TOpenDialog as follows: dlg.InitialDir := 'C:\Temp';