Support » Plugins » Hacks » Media submit hook?

  • How would I call a function when a file is uploaded? I want to call my custom S3 script when a new item is added to the uploads folder.

    Any help would be greatly appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
  • add_action('add_attachment, 'YOUR_FUNCTION');

    Hmm… that does not seem to be working.

    Actually I was not clear enough..

    I need to call this bit of PHP when a file is uploaded, deleted or edited.

    $output = shell_exec(“bash ./”); echo $output;

    I can’t seem to find the right code to execute this when any of the above happen. Examples and help would be greatly appreciated.


    I would do it like this, have no idea if it works though, so consider that.

    add_action('add_attachment', 'my_shell_exec');
    add_action('edit_attachment', 'my_shell_exec');
    add_action('delete_attachment', 'my_shell_exec');
    function my_shell_exec(){
    $output = shell_exec("bash ./");
    echo $output;
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Media submit hook?’ is closed to new replies.