Hello gbernabe,here my system:Server InformationosTicket Version v1.9.15 (70898b3) — Up to dateWeb Server Software Apache/2.4.10 (Debian)MySQL Version 5.5.57PHP Version 5.6.30-0+deb8u1I'm going another way ... when I open OR create a ticket (as agent), all attachments are automatically deleted from the osticket database:Notice: I use ost_ as prefix!Edit:/include/staff/ticket-view.inc.php...//Get the goodies.$dept = $ticket->getDept(); //Dept$staff = $ticket->getStaff(); //Assigned or closed by..$user = $ticket->getOwner(); //Ticket User (EndUser)$team = $ticket->getTeam(); //Assigned team.$sla = $ticket->getSLA();$lock = $ticket->getLock(); //Ticket lock obj$id = $ticket->getId(); //Ticket ID.// start of my mod// count the attachment's of the open ticket $total=db_count('select count(*) from ost_ticket_attachment, ost_file_chunk,ost_file where ticket_id = '.db_input($id).' and ost_ticket_attachment.file_id = ost_file_chunk.file_id and ost_file.id = ost_file_chunk.file_id and ost_file.id = ost_ticket_attachment.file_id');// echo $total;if ($total > 0){$query=('delete ost_ticket_attachment, ost_file_chunk,ost_file from ost_ticket_attachment, ost_file_chunk,ost_file where ticket_id = '.db_input($id).' and ost_ticket_attachment.file_id = ost_file_chunk.file_id and ost_file.id = ost_file_chunk.file_id and ost_file.id = ost_ticket_attachment.file_id');$res = db_query($query);}// end of my modBest Regardscitrixraptor