Created
December 3, 2021 14:31
-
-
Save anthonysbrown/ce5e2ecdd009bb02f255180c736323f4 to your computer and use it in GitHub Desktop.
Do something after file upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
$target_path= full path of uploaded file (not yet inserted into db) | |
$uid = the ID of the user uploading the file | |
*/ | |
add_action('sp_cdm_after_file_upload','my_file_insert',10,3); | |
function my_file_insert($target_path,$uid){ | |
if(my_custom_check_file($target_path) == false){ | |
unlink($target_path); | |
die('{"OK": 0, "info": "File did not pass my custom check"}'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment