When I use the api, everything works except the image. as payload for the ticket I use the given xml in the api documentation: <?xml version="1.0" encoding="UTF-8"?>
<ticket alert="true" autorespond="true" source="API">
<name>Angry User</name>
<email>api@osticket.com</email>
<subject>Testing API</subject>
<phone>318-555-8634X123</phone>
<message type="text/plain"><![CDATA[Message content here]]></message>
<attachments>
<file name="file.txt" type="text/plain"><![CDATA[
File content is here and is automatically trimmed
]]></file>
<file name="image.gif" type="image/gif" encoding="base64">
R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwy
GHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ
+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnK
PjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6
mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3u
Nna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7
</file>
</attachments>
<ip>123.211.233.122</ip>
</ticket>

The newly created ticket will show the attachments image.gif, but when I download and try to view the image it just says "sorry we cant open this file". Ive tried with different images and tried it in json but its all the same. Im using v1.14.3

@swaptoo

Look in the database, go to the ost_file table, find the file, grab the file_id, go to the ost_file_chunk table, lookup where file_id equals the one you grabbed a second ago, and see if all of the filedata is inside the table.

Cheers.

    @swaptoo

    Also, look at all of your error logs for any related errors (Apache error logs, php error logs, server logs, mysql logs, osTicket system logs, and browser console logs).

    Cheers.

    7 days later

    KevinTheJedi I looked at the table and the logs, the logs show no errors. When looking in the os_file_chuck table it also has the data stored in a blob and we can see nothing wrong with the data. any other ideas?

    @swaptoo

    You found the file that you added via API in the ost_file table and you found the ost_file_chunk data that matches it? If so, do you see an ost_attachment record with the ost_file.id?

    Cheers.

      11 days later

      KevinTheJedi
      Yes i have found the file that i added in API and yess i see an ost_attachment record witg the ost_file.id but it doesnt work.

      @swaptoo

      That means either the ost_attachment record is not fully correct or the ost_file_chunk data is corrupt. Please look at the ost_attachment record and make sure it's tied to the correct ost_thread_entry record (the ost_attachment record should have type = 'H' and the object_id should match the corresponding ost_thread_entry record's id). If the ost_attachment record looks correct then you will need to look at the ost_file_chunk data to ensure it's fully correct as well.

      If it's the ost_file_chunk data that's corrupt, you should be able to visit the ticket and see an error in the Browser Console Tab, the Browser Network Tab, Apache Error logs, or PHP Error logs.

      Cheers.

        14 days later

        @swaptoo

        You definitely should have this table. If not your tickets wouldn't even load (ie. the page would hang and throw a fatal error). Below is a screenshot of all the ost_thread* tables that every installation running the latest code should have:

        Cheers.

          KevinTheJedi I dont have ost_thread only some of them without thread foar and still i can open my tickets and everything

          @swaptoo

          Run this in MySQL:

          CREATE TABLE `ost_thread_entry` (
            `id` int unsigned NOT NULL AUTO_INCREMENT,
            `pid` int unsigned NOT NULL DEFAULT '0',
            `thread_id` int unsigned NOT NULL DEFAULT '0',
            `staff_id` int unsigned NOT NULL DEFAULT '0',
            `user_id` int unsigned NOT NULL DEFAULT '0',
            `type` char(1) NOT NULL DEFAULT '',
            `flags` int unsigned NOT NULL DEFAULT '0',
            `poster` varchar(128) NOT NULL DEFAULT '',
            `editor` int unsigned DEFAULT NULL,
            `editor_type` char(1) DEFAULT NULL,
            `source` varchar(32) NOT NULL DEFAULT '',
            `title` varchar(255) DEFAULT NULL,
            `body` text NOT NULL,
            `format` varchar(16) NOT NULL DEFAULT 'html',
            `ip_address` varchar(64) NOT NULL DEFAULT '',
            `recipients` text,
            `created` datetime NOT NULL,
            `updated` datetime NOT NULL,
            PRIMARY KEY (`id`),
            KEY `pid` (`pid`),
            KEY `thread_id` (`thread_id`),
            KEY `staff_id` (`staff_id`),
            KEY `type` (`type`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

          Cheers.

            Write a Reply...