I battled this problem a few months ago. The solution I finally came up with was to use WinSCP and it's built-in scripting language to do it.
http://winscp.net/eng/index.phpObviously the tricky part is coming up with the script - which will look something like this:
option batch on
option confirm off
open username:password@hostname.org
cd /ftp/myFTPdir/
option transfer binary
get -delete renamed_download_filename.txt downloadfilename.sdf
close
exit
...and that needs to be in a txt file - then you run the .txt file with a .bat file
winscp /console /script=theabovescript_Script.txt /log=wlog.txt
if errorlevel 1 goto error
echo Success
Del failed.flg
goto end
:error
echo Error!
Del Success.flg
:end
...so what I've done is:
1. In my VFP application, create the above .txt and .bat files
2. Create 2 other files - failed.flg and success.flg
3. Run the .bat file from VFP via shellexecute
4. Too see if it worked check which of the two .flg files got deleted.
...not the cleanest implementation I've ever done - but hey it works and WinSCP is free.
Only other tricky thing is how your sFTP handles the certificates...for me I have to run WinSCP and connect to the sFTP once on the user's workstation to get the certificate prior to user's being able to use it.
>Hello all and thanks for your help!!!!
>
>I need to upload a text file to a secure FTP server, I've been using a DLL from MarshalSoft.com that works well but not with secure FTP connections, is there any code that I can use to upload files to a secure ftp server? This is very important, any help will be greatly appreciated!
>
>Thanks again,
>
>Juan Urbina
ICQ 10556 (ya), 254117