SFTP upload
Moderator: Rathinagiri
SFTP upload
Nice day all
I needed to help upload the file to the SFTP server
In the forums, I have seen only classic FTP without security
Thanks for help
I needed to help upload the file to the SFTP server
In the forums, I have seen only classic FTP without security
Thanks for help
Re: SFTP upload
I think this is possible using hbcUrl lib.
https://harbour.github.io/contribs
https://curl.haxx.se/libcurl/
https://harbour.github.io/contribs
https://curl.haxx.se/libcurl/
Re: SFTP upload
Thanks for help
I will look at the functions of the lib.
If you use the lib, you could provide a sample code
Best Regards Georg
I will look at the functions of the lib.
If you use the lib, you could provide a sample code
Best Regards Georg
Re: SFTP upload
Hello,
Yes, it works with CURL. I've been trying for more than a year.
And you can test with online demo SFTP/FTP server, if you need http://ftp-server.demo.solarwinds.com/
id: demo
psw: demo
You will find more help on the forum for CURL if you need it.
Yes, it works with CURL. I've been trying for more than a year.
Code: Select all
fm:="test"
If ! Empty( curl := curl_easy_init() )
hb_default( @cUL, "sftp://demo:demo@ftp-server.demo.solarwinds.com/upload/TEST.TXT" )
curl_easy_setopt( curl, HB_CURLOPT_URL, cUL )
curl_easy_setopt( curl, HB_CURLOPT_UPLOAD)
curl_easy_setopt( curl, HB_CURLOPT_PROTOCOLS, HB_CURLPROTO_SFTP )
curl_easy_setopt( curl, HB_CURLOPT_UL_FILE_SETUP, "C:\1\TEST.TXT" )
curl_easy_setopt( curl, HB_CURLOPT_INFILESIZE, len(fm) )
curl_easy_perform( curl )
curl_easy_reset( curl )
curl_easy_cleanup( curl )
Endif
curl_global_cleanup()
id: demo
psw: demo
You will find more help on the forum for CURL if you need it.
Best regards,
Gabor
Gabor
Re: SFTP upload
Thank you very much. I'll test it.
I have tried to search the forum under ftp sftp and have found nothing relevant.
I did not think of entering CURL
I have tried to search the forum under ftp sftp and have found nothing relevant.
I did not think of entering CURL
Re: SFTP upload
Almost true, but this is wrong:mlnr wrote: ↑Wed Jul 26, 2017 9:00 am Hello,
Yes, it works with CURL. I've been trying for more than a year.
And you can test with online demo SFTP/FTP server, if you need http://ftp-server.demo.solarwinds.com/Code: Select all
fm:="test" If ! Empty( curl := curl_easy_init() ) hb_default( @cUL, "sftp://demo:demo@ftp-server.demo.solarwinds.com/upload/TEST.TXT" ) curl_easy_setopt( curl, HB_CURLOPT_URL, cUL ) curl_easy_setopt( curl, HB_CURLOPT_UPLOAD) curl_easy_setopt( curl, HB_CURLOPT_PROTOCOLS, HB_CURLPROTO_SFTP ) curl_easy_setopt( curl, HB_CURLOPT_UL_FILE_SETUP, "C:\1\TEST.TXT" ) curl_easy_setopt( curl, HB_CURLOPT_INFILESIZE, len(fm) ) curl_easy_perform( curl ) curl_easy_reset( curl ) curl_easy_cleanup( curl ) Endif curl_global_cleanup()
id: demo
psw: demo
You will find more help on the forum for CURL if you need it.
Code: Select all
curl_easy_setopt( curl, HB_CURLOPT_INFILESIZE, len(fm) )
Code: Select all
curl_easy_setopt( curl, HB_CURLOPT_INFILESIZE, FILESIZE("C:\1\TEST.TXT") )
Copy the files from the "dll" folder to "c:\hmg.3.4.4\HARBOUR\lib\win\mingw\", where: "c:\hmg.3.4.4" is the location of HMG 3.4.4.
Tested on local SFTP Bitvise SSH Server and HMG 3.4.4
- Attachments
-
- sftp.7z
- (2.34 MiB) Downloaded 426 times
Re: SFTP upload
Thank you, Edward. This is more complex than my test code snippet.
Best regards,
Gabor
Gabor
Re: SFTP upload
Thank you EDK really great.
Thumb up.
Thumb up.
Re: SFTP upload
For compilations, add them to SFTP.HBC
libs=hbcurls
libs=hbcurl
libs=libcurl
libs=hbcurls
libs=hbcurl
libs=libcurl