-- You should add the below scripts to the event manager -> FTP or HTTP OnFileUploaded
-- When a file is uploaded, it can be sent to one or two or even more FTP servers automatically
-- Author: Luke
-- Date: 2012-10-07
Code: Select all
require("socket.ftp")
require("socket.ltn12")
--send the file to the first FTP server
f, e = put{
host = "192.168.0.100",
user = "user1",
password = "pass1",
port = 21,
argument = "/%FileName",
source = source.file(io.open("%PathName", "rb"))
}
--send the file to the second FTP server
f, e = put{
host = "192.168.0.105",
user = "user2",
password = "pass2",
port = 21,
argument = "/ftpfolder/%FileName",
source = source.file(io.open("%PathName", "rb"))
}
The above scripts use a modified version of luasocket library, you can download and unzip it into the working directory of Wing FTP Server. The download URL: https://www.wftpserver.com/bbsres/socket.zip