Page 1 of 1

Write a MSMQ message when a file is uploaded

PostPosted: Thu Dec 13, 2012 6:55 am
by FTP
-- Description: write a MSMQ message when a file is uploaded
-- Author: Luke
-- Date: 2012-12-13

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

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

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: