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.
11 Failed to execute lua script of event OnFileUploaded
-
- Posts: 1
- Joined: Thu Jun 16, 2022 9:34 am
-
- Site Admin
- Posts: 2084
- Joined: Tue Sep 29, 2009 6:09 am
Re: 11 Failed to execute lua script of event OnFileUploaded
Which version of WingFTP are you using? And is WingFTP running on Windows or Linux?
-
- Posts: 6
- Joined: Thu Jun 16, 2022 2:46 pm
Re: 11 Failed to execute lua script of event OnFileUploaded
Hi,
We are running the WING FTP server on Windows and the installed version is 7.0.4
Thank you.
We are running the WING FTP server on Windows and the installed version is 7.0.4
Thank you.
-
- Site Admin
- Posts: 2084
- Joined: Tue Sep 29, 2009 6:09 am
Re: 11 Failed to execute lua script of event OnFileUploaded
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.
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.
-
- Posts: 6
- Joined: Thu Jun 16, 2022 2:46 pm
Re: 11 Failed to execute lua script of event OnFileUploaded
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)!
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)!
-
- Site Admin
- Posts: 2084
- Joined: Tue Sep 29, 2009 6:09 am
Re: 11 Failed to execute lua script of event OnFileUploaded
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
-
- Posts: 6
- Joined: Thu Jun 16, 2022 2:46 pm
Re: 11 Failed to execute lua script of event OnFileUploaded
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.
Still having the same issue.
-
- Site Admin
- Posts: 2084
- Joined: Tue Sep 29, 2009 6:09 am
Re: 11 Failed to execute lua script of event OnFileUploaded
OK, it seems you missed the first two lines:
require("socket.ftp")
require("socket.ltn12")
require("socket.ftp")
require("socket.ltn12")
-
- Posts: 6
- Joined: Thu Jun 16, 2022 2:46 pm
Re: 11 Failed to execute lua script of event OnFileUploaded
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!
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!
-
- Site Admin
- Posts: 2084
- Joined: Tue Sep 29, 2009 6:09 am
Re: 11 Failed to execute lua script of event OnFileUploaded
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.