Are File Handlers Supported for Subdirectories

Hello,

I have a handler for afterSaveFileFromByteArray File events that works correctly and consistently for the app-files directory. The same handler is ignored for subdirectories. Are event handlers supported for subdirectories of backendless top-level directories?

The “New Event Handler” dialog allows me to type subdirectory names in the Context field, but won’t save them and the dropdown says “No results found” even for existing directories. If I replace the context in the handler (in the console, or using coderunner) like this:

Backendless.ServerCode.File.afterSaveFileFromByteArray('app-files/mysubdir', async function(req, res) {
    // blah
});

the handler compiles and deploys correctly, the Event Handlers screen shows the correct directory “app-files/mysubdir” in the Context column - everything looks perfect. But the handler is never called.

I can modify my app to use only the app-files directory, but I would rather use subdirectories if possible.

Thank you,

Kelly
App Id: 8149FCCE-07DA-F988-FFBB-6154872C9500

Hi @Kelly_Oglesby,

if you put just app-files as event context, it would work for any file uploaded into this directory and all its subdirectories.
There is no way to track only some concrete subdirectory, but if you need to, you can check file path in your logic (you may take it from the request context).

Regards,
Stanislaw

Yep, trying to specify the subdirectory was causing the handler to be ignored - just using ‘app-files’ did the trick. That’s even easier - I thought I was going to have to maintain multiple handlers for different directories, that all did the same thing.

Thank you, Stanislaw!