Add File

This command is used to add a file a WHMCSPM2 Project or Task in your WHMCS system. You just need to send the projectid or taskid and the attributes from below.
PLEASE NOTE - This API function is not supported using the localapi function.

Attributes

reltype - project or task
relid - projectid or taskid
clientviewable - allow client to view file (0 or 1)
name - Nice filename
description - description of uploaded file
file - file to be uploaded
customfields - base64 encoded serialized array of custom fields

Example Command

$postfields["action"] = "whmcspm2addfile";
$postfields["reltype"] = "project";
$postfields["relid"] = "1";
$postfields["clientviewable"] = "1";
$postfields["name"] = "Some File";
$postfields["description"] = "This is a sample description of an uploaded file.";
$postfields["file"] = "@/path/to/some/file.pdf";
$customfields = array("1" => "Some Value","2" => "Some Other Value");
$postfields["customfields"] = base64_encode(serialize($customfields));

Returned Variables

result - error / success
fileid
Was this answer helpful? 0 Users Found This Useful (41 Votes)