Upload Weblink notification to originator

You can share your Lua Scripts with everybody here.
Post Reply
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Upload Weblink notification to originator

Post by FTP »

First, you should insert the below scripts into "Event Manager -> HTTP -> OnFileUploaded -> Lua Script":

Code: Select all

local domain = "%Domain"
local username = "%Name"
local weblink = "%WebLink"
local filename = "%FileName"
local client_ip = "%IP"

if username == "<UPLOADLINK>" then
	local result = c_ExecuteSQL("select f_email from wftp_weblink where f_domain='"..domain.."' and f_is_uplink=1 and f_weblink='"..weblink.."' limit 1")
	if result[1] ~= nil and result[1][0] ~= "" then
		local arrEmail = Split(result[1][0], "|")
		if table.maxn(arrEmail) == 2 and arrEmail[2] ~= "" then
			local notifyEmail = arrEmail[2]
			c_SendMail(notifyEmail, "File uploaded via uploadlink "..weblink, "Client "..client_ip.." uploaded the file '"..filename.."'.", "", "SMTP_CONFIG") 
		end
	end
end
Here, "SMTP_CONFIG" is the SMTP configuration name, you can add a SMTP configuration at "Server > Settings > SMTP Manager".

Image


Then you can login the web client and create a File Upload Request, just check on the option "Send email to" and input the recipient's email address, and specify the originator's email address in the filed "My email address".
So when the recipient uploads files via the upload link, an email notification will be sent to the originator.

Image
Post Reply