forked from Spoje-NET/php-abraflexi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAttachmentUpload.php
More file actions
28 lines (23 loc) · 861 Bytes
/
AttachmentUpload.php
File metadata and controls
28 lines (23 loc) · 861 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
#!/usr/bin/php -f
<?php
/**
* AbraFlexi - Example how to upload Attachment
*
* @author Vítězslav Dvořák <info@vitexsofware.cz>
* @copyright (G) 2017-2024 Vitex Software
*/
namespace Example\AbraFlexi;
include_once './config.php';
include_once './common.php';
$invoiceID = askForFlexiBeeID();
$invoice = new \AbraFlexi\FakturaVydana($invoiceID);
$result = \AbraFlexi\Priloha::addAttachmentFromFile($invoice, '../project-logo.png');
if ($result->lastResponseCode == 201) {
$allAttachments = \AbraFlexi\Priloha::getAttachmentsList($invoice);
$lastAttachment = end($allAttachments);
$invoice->addStatusMessage('Attachment '.$invoice->getAbraFlexiURL().'/prilohy/'.$lastAttachment['id'].'/content OK',
'success');
} else {
$invoice->addStatusMessage('Attachment '.$invoice->getAbraFlexiURL().' Failed',
'error');
}