Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
–1 vote
339 views
in CompleteFTP by (320 points)
Hello everyone,

Let's assume the following usage: a non-Windows user logs in via http/s. During this session, he uploads several files to different folders.

I would like, at the end of this work session (at logout), send a report to the user's email containing the names of files that were uploaded and in which folders. As proof that the uploads were made, with the date and time if possible.

How can I do this using events?

Thanks!

2 Answers

0 votes
by (51.6k points)
selected by
 
Best answer

That was a fun question. I solved it using two process triggers with JSS scripts.

The first triggers on the Upload file event. It stores the path of the uploaded file in a user tag named 'uploads':

let uploads = system.user.tags.get("uploads");
if (!uploads)
    uploads = [];
uploads.push(event.virtualPath);
system.user.tags.set("uploads", uploads);

The second triggers on the Logout event. It checks if there's a user tag named 'uploads' and the logged in user has an email set. If so then it sends the list of uploaded files to the email of the logged in user:

let uploads = system.user.tags.get("uploads");
system.user.tags.remove("uploads");
if (uploads)
    mail.send(
        "sender@email.address",
        event.loginEmail,
        "Uploaded files",
        "The following files were uploaded:\n - " + uploads.join("\n - ")
    );
0 votes
by (9.1k points)

Please see here in our user guide.

by (320 points)
If I understood correctly, doing it this way, for each file that is uploaded, the user will receive an email. If during a work session, the user uploads 50 files, he will receive 50 emails.

Using an example I found in the documentation, I was able to generate a txt file with the name of all the files that were uploaded, with date and time.

Now what I couldn't solve is how to attach this txt file to an email notification. Is it possible?

Thank you for your patience with this inexperienced user.
by (51.6k points)
I've added my response to this comment as a separate answer.

Categories

...