Docs / Action Reference / wpdm_before_upload_file – Action triggers before uploading a file

wpdm_before_upload_file – Action triggers before uploading a file

Description


This hook is triggered immediately before uploading a file.

Parameters


One parameter/argument is passed to this hook.

Usage

<?php 
   add_action("wpdm_before_upload_file", "callack_function",10,1);
?>

Examples

<?php 
add_action("wpdm_before_upload_file", "block_file_type", 10, 1); 
function block_file_type($FILE)
    {     
        $ext = explode('.', $FILES['name']);         
        $ext = end($ext);         
        $ext = strtolower($ext);
        if($ext == 'xml') die('-3'); 
        //if you want to block xml file upload 
    } 
?>

Related

Last updated on January 26, 2026

Need Help?

Get support from our team or community forum.

Visit Support

Customization

Need custom features? We can help.

Request Quote