SiteDrive Files API
These functions offer a way to both read, add, and delete files within SiteDrive.
sitedrive_file
This is the basic read by ID function.
Arguments
$id |
The ID of the file from the SiteDrive table |
Returns
Associative Array
file. Or throws an error if trying to grab a file that does not exist.
sitedrive_file_add
Add a file to a folder which belongs to a drive.
Arguments
$fileInsert |
A file array. Requires value folder_id , type , type_id , and name |
Returns
int
of the SiteDrive file id. Throws an error if it could not insert based on your arguments.
sitedrive_file_delete
This will delete a file by an ID. If the ID does not exists it will not do anything.
Arguments
$id |
The ID of the file from the SiteDrive table |
sitedrive_file_delete_by
General purpose delete by a select number of fields. It is most commonly used to delete by a folder_id
.
Arguments
$fields |
Associative array of field names pointing to a value |
Example
sitedrive_file_delete_by([ 'folder_id' => 123 ]);