Page 1 of 2

11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 9:53 am
by robermirza
Hi,
I was trying to add this Lua Script to my WING FTP Server. I have seen an error on the domain-log when a file was upload
The script isn't executing and it returns this message : Failed to execute lua script of event OnFileUploaded.

I took the script from this forum, this is the post: https://bbs.wftpserver.com/viewtopic.php?f=6&t=2898
Also i unzipped the lua library into the working directory.

The script:

require("socket.ftp")
require("socket.ltn12")

f, e = put{
host = "server.ip/name",
user = "user",
password = "pwd",
port = 21,
argument = "/%FileName",
source = source.file(io.open("%PathName", "rb"))
}


Could someone help me?
Thank you.

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 2:16 pm
by FTP
Which version of WingFTP are you using? And is WingFTP running on Windows or Linux?

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 2:47 pm
by robermirza0
Hi,

We are running the WING FTP server on Windows and the installed version is 7.0.4

Thank you.

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:08 pm
by FTP
OK, so please execute the Lua script under "Administrator -> Console", and check the result first, for example:


require("socket.ftp")
require("socket.ltn12")

f, e = put{
host = "192.168.1.1",
user = "Username",
password = "Password",
port = 21,
argument = "/socket.zip",
source = source.file(io.open("d:/socket.zip", "rb"))
}



Suppose you have a file "d:/socket.zip" on the local machine.

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:22 pm
by robermirza0
hi,

i tried with this on the administrator's console:

f, e = put{
host = "server.ip",
user = "user",
password = "pwd",
port = 21,
argument = "/p1.txt",
source = source.file(io.open("E:\prueba\p1.txt", "rb"))
}

and the result was that:

some error in [string "f, e = put{ host = "server.ip", user =..."]:1: attempt to index global 'source' (a nil value)!

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:30 pm
by FTP
OK, it means you didn't unzip the Lua library files into a correct place, they should be unzipped into the folder "socket" under WingFTP's folder, like this: C:\Program Files (x86)\Wing FTP Server\socket\core.dll

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:35 pm
by robermirza0
I have already checked it, the folder is in the right path and it contains all the files from the zip.
Still having the same issue.

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:38 pm
by FTP
OK, it seems you missed the first two lines:

require("socket.ftp")
require("socket.ltn12")

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:42 pm
by robermirza0
Hi,

Now i tried to put all the script in 1 line like this:

require("socket.ftp") require("socket.ltn12") f, e = put{ host = "serverip", user = "usr", password = "pwd", port = 21, argument = "/p1.txt", source = source.file(io.open("E:\prueba\p1.txt", "rb")) }

The result was just this : exception!

Re: 11 Failed to execute lua script of event OnFileUploaded

Posted: Thu Jun 16, 2022 3:51 pm
by FTP
It means you can't connect to that ftp server, maybe wrong username/password or wrong server address? You can check the ftp server logs under the destination server.