11 Failed to execute lua script of event OnFileUploaded

Please post here if you have problems in using Wing FTP Server.
robermirza
Posts: 1
Joined: Thu Jun 16, 2022 9:34 am

11 Failed to execute lua script of event OnFileUploaded

Post 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.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: 11 Failed to execute lua script of event OnFileUploaded

Post by FTP »

Which version of WingFTP are you using? And is WingFTP running on Windows or Linux?
robermirza0
Posts: 6
Joined: Thu Jun 16, 2022 2:46 pm

Re: 11 Failed to execute lua script of event OnFileUploaded

Post by robermirza0 »

Hi,

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

Thank you.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: 11 Failed to execute lua script of event OnFileUploaded

Post 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.
robermirza0
Posts: 6
Joined: Thu Jun 16, 2022 2:46 pm

Re: 11 Failed to execute lua script of event OnFileUploaded

Post 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)!
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: 11 Failed to execute lua script of event OnFileUploaded

Post 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
robermirza0
Posts: 6
Joined: Thu Jun 16, 2022 2:46 pm

Re: 11 Failed to execute lua script of event OnFileUploaded

Post 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.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: 11 Failed to execute lua script of event OnFileUploaded

Post by FTP »

OK, it seems you missed the first two lines:

require("socket.ftp")
require("socket.ltn12")
robermirza0
Posts: 6
Joined: Thu Jun 16, 2022 2:46 pm

Re: 11 Failed to execute lua script of event OnFileUploaded

Post 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!
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: 11 Failed to execute lua script of event OnFileUploaded

Post 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.
Post Reply