-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattach.php
More file actions
33 lines (27 loc) · 825 Bytes
/
attach.php
File metadata and controls
33 lines (27 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
include('include.php');
try {
$id = get('id', null, 'POST');
$entity = get('entity', null, 'POST');
$email = get('email', null, 'POST');
$files = [];
foreach ($_FILES['file']['name'] as $key=>$null) {
$files[] = [
'name' => $_FILES['file']['name'][$key],
'path' => $_FILES['file']['tmp_name'][$key],
];
}
$class = '\Rangka\Quickbooks\Services\\' . ucfirst($entity);
$service = new $class;
$response = $service->attach($id, $files, true);
echo json_encode($response);
}
catch (\GuzzleHttp\Exception\ClientException $e) {
echo (string) $e->getResponse()->getBody();
}
catch (\GuzzleHttp\Exception\ServerException $e) {
echo (string) $e->getResponse()->getBody();
}
catch (\Exception $e) {
echo $e->getMessage();
}