File Manager Hooks

filemanager_pre.sh

This hook script is to be called before DA runs anything from CMD_FILE_MANAGER or CMD_API_FILE_MANAGER.

Saves needing to use all_pre.sh for File Manager-related blocks.

Environment variables

All GET/POST variables are passed via the environment.

  • path : directory where the action is happening
  • api (0|1): whether or not the action originated from the api (CMD_API_FILE_MANAGER)
  • fileX : file name of uploaded file... variable generated for every uploaded file.

file_manager_upload_post.sh

Custom hook script to run after a User has finished uploading a file in the CMD_FILE_MANAGER or CMD_API_FILE_MANAGER.

This would be useful if you'd like to run ClamAV on a given file after the upload.

Note that DA doesn't take any special actions on the files based on the output, other than throwing an error in the resulting upload message.

If you exit with a non-zero result, be sure to echo some text to clarify what the problem is.

E.g., if there was a virus (as decided by ClamAV), you might want to delete the uploaded file in your script, echo a notice about that, and exit 1;.

Environment variables

  • file: location of uploaded file
  • username: uploader username
  • home: home directory of user
Last Updated: 6/23/2021, 9:36:08 PM