Prev |  | Next

### 3.9.4. before_attach

The primary use of this hook would be for creating an alternate storage system for attachments. You would need to use the ??? hook to complete the process as you do not yet have the `file_id` for the file. You will need to use the ??? hook to retreive the file data later.

Call time:

In `include/posting/action_attachments.php`, right before a file attachment is saved in the database.

Hook input:

Two part array where the first element is the message array and the second element is a file array that contains the name, size, and file data.

Hook output:

Same as input.

Example code:

    function phorum_mod_foo_reopen_before_attach($data)
    {
        // Save the file with the amazing alternate_file_storage
        // function I haven't yet created
        alternate_file_storage($data[1]);

        // Remove the file data saved with the alterante_file_storage
        // function
        $data[1]["file_data"] = "";

        return $data;
    }

Prev | Up | Next
| Home |