Write a MSMQ message when a file is uploaded

You can share your Lua Scripts with everybody here.

Write a MSMQ message when a file is uploaded

Postby FTP » Thu Dec 13, 2012 6:55 am

-- Description: write a MSMQ message when a file is uploaded
-- Author: Luke
-- Date: 2012-12-13

Code: Select all
require("luacom")
local queueinfo = luacom.CreateObject("MSMQ.MSMQQueueInfo")
queueinfo.PathName = ".\\private$\\wftpserver"
queueinfo.Label = "Wing FTP Server Queue"
queueinfo:Create()

local queue = queueinfo:Open(2, 0)
if queue ~= nil then
   local message = luacom.CreateObject("MSMQ.MSMQMessage")
   message.Body = "OnFileUploaded|"..os.date("%Y-%m-%d %H:%M:%S").."|%IP|%Name|%PathName|%FileSize"
   message.Label = "File_Uploaded"
   message:Send(queue)
end
queue:Close()


You should add the above lua script to the "OnFileUploaded" event for FTP(HTTP,SSH).

Here we used a LuaCOM lib, you must download it then unzip it into the working directory of Wing FTP Server, the download URL: http://www.wftpserver.com/bbsres/libcom.zip
FTP
Site Admin
 
posts 1232
 
joined Tue Sep 29, 2009 6:09 am

Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron