Page 1 of 1

SFTP file upload

Posted: Sun Jan 15, 2017 11:53 am
by Gurgen
Hi All,

I'm trying to upload file into SFTP server using tsNetUploadFile, but with nor any result.

Here is my code

Code: Select all

local sConID

function uploadFileSFTP pFile, pHost, pUsername, pPassword
   
   add 1 to sConID
   put "sftp://" & pHost & ":22/mnt/myfolder" into tURL
   put true into tSettings["use_ssl"]
   put true into tSettings["no_reuse"]
   put true into tSettings["save_sent_headers"]
   put pUsername into tSettings["username"]
   put pPassword into tSettings["password"]
   
   put tsNetUploadFile(sConID, pFile, tURL,, "uploadDone", tSettings) into tResult

   return tResult
end uploadFileSFTP
tsNetUploadFile returns empty, which means it's OK, but not calling the callback(uploadDone). I think something is wrong with my code, please help to figure out.

Thanks,
Gurgen

Re: SFTP file upload

Posted: Sun Jan 15, 2017 8:38 pm
by jacque
The command also needs a callback parameter, which I don't see in your handler.

tsNetUploadFile(pConnectionID, pFile, pURL, pHeaders, pCallback, [pSettings])

Re: SFTP file upload

Posted: Mon Jan 16, 2017 9:26 am
by Gurgen
jacque wrote:The command also needs a callback parameter, which I don't see in your handler.

tsNetUploadFile(pConnectionID, pFile, pURL, pHeaders, pCallback, [pSettings])
Hi Jacque,

Thank you for replay.

I set the callback parameter to "uploadDone", which to can see in the sample code. I have the handler, but tsNet never sending it, so I assume that something still wrong with my code, but callback is not the problem.

Thanks,
Gurgen

Re: SFTP file upload

Posted: Mon Jan 16, 2017 6:19 pm
by jacque
Yes, I see it now. I did not scroll the short view box far enough down.

What do you see when you get the LC result?

put tsNetUploadFile(sConID, pFile, tURL,, "uploadDone", tSettings) into tResult
put the result into tLResult

Also, what edition of LC are you running? There are restrictions on SFTP transactions if you are not running a business version. Does it work if you use FTP instead?

Re: SFTP file upload

Posted: Tue Jan 17, 2017 11:45 am
by Gurgen
jacque wrote:Yes, I see it now. I did not scroll the short view box far enough down.

What do you see when you get the LC result?

put tsNetUploadFile(sConID, pFile, tURL,, "uploadDone", tSettings) into tResult
put the result into tLResult

Also, what edition of LC are you running? There are restrictions on SFTP transactions if you are not running a business version. Does it work if you use FTP instead?
Hi Jacque,

I'm using LC 8.1.1 Business.

tResult and the result are always empty. Also I have tried with "ftp" instead of "sftp" in URL, but same result.

Thanks,
Gurgen

Re: SFTP file upload

Posted: Tue Jan 17, 2017 11:55 pm
by jacque
Sorry, I'm not sure what the problem is. There are a couple of example stacks for tsNet but I can't find the links. Maybe someone else has them and will post here. Otherwise I think you may need to write to support.

Re: SFTP file upload

Posted: Thu Feb 09, 2017 12:07 pm
by MaxV
Hi all,
in the open source version tsNet is missing, but it's missing also any documentation of it; so who uses livecode open source can't know what tsNet do.
I ask you the favour to fill the end of this page: http://livecode.wikia.com/wiki/TsNet
with all information you have in your dictionaries about tsNet functions and messages.
Just click on the edit button of the page.

Best regards
Max (livecode evangelist)

Re: SFTP file upload

Posted: Thu Feb 09, 2017 4:58 pm
by FourthWorld
MaxV wrote:Hi all,
in the open source version tsNet is missing, but it's missing also any documentation of it; so who uses livecode open source can't know what tsNet do.
The tsNet external was written by a third party who has not made the source code available under the GPL, which would be needed for inclusion in the GPL-governed LiveCode Community Edition. Bundled under proprietary license, at this time it's only available in the proprietary editions of LiveCode.

All other networking (HTTP, HTTPS, FTP, sockets) are of course available in all editions of LiveCode, including Community.

FTP/FTPS is rarely needed, designed for providing ad hoc access to file repositories. I have one app where it's useful, but for moving data from a client app to a server a more secure and efficient means is to write a CGI for the server to receive the data over HTTP/HTTPS so it can validate the data and put it where it needs to go.

This Lesson describes how to write the CGI in LiveCode using LiveCode Server, and there are many examples on the web for writing that in PHP, Python, and other languages as well:
http://lessons.livecode.com/m/4070/l/40 ... ode-server

Re: SFTP file upload

Posted: Thu Jan 26, 2023 4:02 pm
by trevix
Do we still need a "Business license" (?) to upload to SFTP?

By the way, this page has broken links. Does it still apply?
https://livecode.com/products/livecode- ... iness-b12/

Re: SFTP file upload

Posted: Thu Jan 26, 2023 4:12 pm
by Klaus
Hi Trevix,

as far as I know the tsNet external neccessary for SFTP is only contained in the "Standard plan" (business) version.


Best

Klaus

Re: SFTP file upload

Posted: Thu Jan 26, 2023 4:15 pm
by trevix
Since I have a standard plan, you mean that I have a business plan?

Re: SFTP file upload

Posted: Thu Jan 26, 2023 4:46 pm
by Klaus
Puh, good question, really not sure. :D
Try this in the message box:

Code: Select all

put tsNetVersion()
I got: Version 1.4.8 Business Edition
If that does not throw an error, you have a business version.

Re: SFTP file upload

Posted: Thu Jan 26, 2023 4:50 pm
by trevix
Version 1.4.8 Business Edition

Thanks (Pfuiiiii)

Re: SFTP file upload

Posted: Thu Jan 26, 2023 5:12 pm
by Klaus
trevix wrote:
Thu Jan 26, 2023 4:50 pm
Version 1.4.8 Business Edition
Thanks (Pfuiiiii)
COOOOOL! :-)

Re: SFTP file upload

Posted: Sat Jan 28, 2023 4:37 pm
by bobcole
I tried it on my Mac:
Version 1.4.8 Indy Edition
Bob