Hello, I did as in the demo: #  Originally authored by jared@osTicket.com#  Modified by ntozier@osTicket / tmib.net#  Attachments fixed by ddhnote@gmail.combut I get HTTP code 404 ( if I ignore the attachment option, all is good ) Please advice, Daniel 

404 means not found.  Sounds like your script could not find the attachment.

Thanks for replying. To respond:  Don't think so, because when I use: 'data/mpeg;base64,' . base64_encode(file_get_contents('/path/to/attachment.mp3')),without the word "data" it attaches the encoded string ( a very long one )The path checks out. The file is there. What am I missing? Please advice, Daniel 

2 months later

Hello All, We fixed it. For us the problem was the XSS forgery protection and PCI DSS protection.In the demo example we've added for post:encoded_data = base64_encode(json_encode($data));And in the osTicket files: include/class.api.php we've replaced:$decoded_data = parent:($stream);   with:   $decoded_data = $this->base64_parse($stream);and added:function base64_parse($stream) {        if (is_resource($stream)) {            $contents = '';            while (!feof($stream))                $contents .= fread($stream, 8192);        } else            $contents = $stream;        return json_decode(base64_decode($contents), true);    }Thanks. I hope you find this useful. 

3 years later
Write a Reply...