diff --git a/lib/API.php b/lib/API.php
index <HASH>..<HASH> 100644
--- a/lib/API.php
+++ b/lib/API.php
@@ -79,6 +79,9 @@ class API {
         // Optional file attachment
         if (isset($payload['files'])) {
             foreach ($payload['files'] as &$file) {
+              if (is_array($file) && isset($file['id']) && isset($file['data'])) {
+                  continue;
+              }
               $file = array(
                   "id" => basename($file),
                   "data" => $this->encode_attachment($file)
diff --git a/test/APITest.php b/test/APITest.php
index <HASH>..<HASH> 100644
--- a/test/APITest.php
+++ b/test/APITest.php
@@ -71,9 +71,9 @@ class APITestCase extends PHPUnit_Framework_TestCase
             )
         );
 
-        $this->inline = 'test/test_img.png';
+        $this->inline = __DIR__ . '/test_img.png';
 
-        $this->files = array('test/test_img.png', 'test/test_txt.txt');
+        $this->files = array(__DIR__ . '/test_img.png', __DIR__ . '/test_txt.txt');
 
         $this->tags = array('tag_one', 'tag_two');
Added possibility to provide encoded files to the API