class CRM_Core_Page_AJAX_Attachment

CRM_Core_Page_AJAX_Attachment defines an end-point for AJAX operations which upload file-attachments.

To upload a new file, submit a POST (multi-part encoded) to "civicrm/ajax/attachment". Inputs: - POST['entity_table']: string - POST['entity_id']: int - POST['attachment_token']: string - FILES[*]: all of the files to attach to the entity

The response is a JSON document. Foreach item in FILES, there's a corresponding record in the response which describes the success or failure.

Note: The permission requirements are determined by the underlying Attachment API.

Constants

ATTACHMENT_TOKEN_TTL

Methods

static 
attachFile()

(Page Callback)

static array
_attachFile(array $post, array $files, array $server)

No description

static 
sendResponse(array $result)

No description

static string
createToken()

No description

static bool
checkToken(string $token)

No description

Details

at line 49
static attachFile()

(Page Callback)

at line 63
static array _attachFile(array $post, array $files, array $server)

Parameters

array $post Like global $_POST.
array $files Like global $_FILES.
array $server Like global $_SERVER.

Return Value

array

at line 129
static sendResponse(array $result)

Parameters

array $result List of API responses, keyed by file.

at line 151
static string createToken()

Return Value

string

at line 167
static bool checkToken(string $token)

Parameters

string $token A token supplied by the user.

Return Value

bool TRUE if the token is valid for submitting attachments

Exceptions

Exception