Hi,
I've been struggling with sockets for the past few days.
The app I'm making is a survey; You answer questions and each result is stored in a table. At the end of the survey I iterate through the elements of the table and append them to a string :
local str = ""
for i=1,#answers do
str = str..answers[i]..","
end |
So, after the survey I end up with a .csv string. What I want then, is to append that string to a .txt file that is stored remotely in a FTP server.
And now what I've tried with the sockets....
local socketftp = require("socket.ftp")
local hostftp = "domain.com"
local client = socketftp.open(hostftp,21,create)
client:greet()
client:login("username","password")
local fi = io.open("|D|testftp.txt","wb")
client:send(hostftp,fi) |
Ok, so I believe it does the login correctly (if I enter a wrong username/password it times out and crashes), but I don't really know how to use the client:send() command...
Any help would be much appreciated.
Kind Regards.
Comments
But I have no tried it myself, its what I get from examples
attempt to index local 'ftp' (a boolean value)
Also... where can I find examples of the ftp for Gideros ?
The example I was referring to is:
http://w3.impa.br/~diego/software/luasocket/ftp.html
and I tried it myself now and needed to add more file from luasocket and make ftp code dependent on url and tp and the correct code seems to be:
This code will create a file in the ftp server with the text specified. If the file exists, it will erase its contents.
Likes: MoKaLux
in other platforms, you would need to copy files into your project and then use them from there
Glad it worked for you