/** * Creates new attachment for ticket post with contents read from physical file. * WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result. * * @param kyTicketPost $ticket_post Ticket post. * @param string $file_path Path to file. * @param string $file_name Optional. Use to set filename other than physical file. * @return kyTicketAttachment */ public static function createNewFromFile($ticket_post, $file_path, $file_name = null) { $new_ticket_attachment = new kyTicketAttachment(); $new_ticket_attachment->setTicketId($ticket_post->getTicketId()); $new_ticket_attachment->setTicketPostId($ticket_post->getId()); $new_ticket_attachment->setContentsFromFile($file_path, $file_name); return $new_ticket_attachment; }