Upload Weblink notification to originator

You can share your Lua Scripts with everybody here.

Upload Weblink notification to originator

Postby FTP » Wed May 13, 2020 8:33 am

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_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
FTP
Site Admin
 
1732
 
Tue Sep 29, 2009 6:09 am

Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 4 guests