Skip to content

Commit

Permalink
Adds feature-100 - attachemtnes from binary/memory
Browse files Browse the repository at this point in the history
  • Loading branch information
calcinai committed Oct 5, 2015
1 parent bfe2289 commit 336f6ee
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/XeroPHP/Models/Accounting/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ public static function createFromLocalFile($file_name, $mime_type = null){
return $instance;
}


public static function createFromBinary($data, $file_name, $mime_type){

$content_length = strlen($data);

$instance = new self();
$instance->fromStringArray(array(
'MimeType' => $mime_type,
'ContentLength' => $content_length,
'FileName' => $file_name
));

$instance->content = $data;

return $instance;
}

/**
* @return string
*/
Expand Down

0 comments on commit 336f6ee

Please sign in to comment.