Attachments¶
Files can be attached to tickets, for example screenshots, logs or sample data.
Adding an attachment¶
On the new ticket form, or the update form on an existing ticket, choose a file
with the Attachment field and submit as usual. The field only appears for
users with the add_attachments permission.
- One file per submission. To attach several files, update the ticket once for each.
- The file's name and type are kept. The type is detected from the file's contents, not from its extension.
- Adding an attachment is recorded in the ticket's history.
Viewing and downloading¶
Attachments are listed on the ticket page and served from
/attachments/{id}/{filename}. Viewing needs the view_attachments permission
in the ticket's project. A user without it is shown a no-permission page, so
attachments can be hidden from guests even when tickets are public.
To keep uploaded files from being used to attack other users, Traq serves them cautiously:
| File type | Behaviour |
|---|---|
| Images (PNG, JPEG, GIF, …) | Shown in the browser |
| Text files | Shown in the browser as plain text, whatever the file actually contains (HTML files are not rendered) |
| SVG images | Always downloaded, never displayed, since SVGs can contain scripts |
| Everything else (PDF, archives, documents, …) | Downloaded |
Attachments are also sent with headers that stop browsers guessing a different type and that block scripts, framing and external resources.
Files larger than 50 MB are refused when viewed (the ticket page shows an error instead).
Deleting¶
Users with delete_attachments can delete an attachment from the ticket page.
Deleting removes the file permanently.
Permissions¶
| Permission | Default |
|---|---|
add_attachments |
Members, Developers and Managers. Denied to Guests |
view_attachments |
Everyone |
delete_attachments |
Managers (and administrators) only |
These can be changed per group and per role; see Permissions, Groups & Roles.
Server limits¶
Traq doesn't set its own upload size limit, so the effective limit comes from your server. If uploads fail with an "unable to upload file" error, check:
- PHP's
upload_max_filesizeandpost_max_sizeinphp.ini - Your web server's request body limit (for nginx,
client_max_body_size) - MariaDB/MySQL's
max_allowed_packet, which must be larger than the file
Where files are stored
Attachments are stored in the database (Base64-encoded, so about a third larger than the original), not on disk. Large attachments will make the database, and its backups, grow accordingly. Include your database in your backups to keep attachments safe.