I am testing attachment uploads in our MantisBT installation and putting those uploads onto an NFS file system.
Since this is open-source software and our attachments could be needed for audits for up to three years, I have been asked what we would do if something happened and MantisBT was not able to properly associate uploaded documents to our changes for some reason. Currently, MantisBT creates separate directories for each Project, but then uses a unique file name across all the tickets. I am not able to determine how I can determine the bug/ticket number from the file name.
As such, we are hesitant to trust MantisBT to handle all of our Compliance documents.
Am I overlooking a setting or some mapping method that would allow tracing from the file names to the associated ticket?
attachment upload to DISK into directories by ticket number
Moderators: Developer, Contributor
-
michaelgeorge
- Posts: 4
- Joined: 17 Mar 2023, 18:41
Re: attachment upload to DISK into directories by ticket number
You can do that with a simple query using a tool like phpmyadmin.
I you have issues with that, I canhelp you to creatde such a query
I you have issues with that, I canhelp you to creatde such a query
-
michaelgeorge
- Posts: 4
- Joined: 17 Mar 2023, 18:41
Re: attachment upload to DISK into directories by ticket number
We have returned to testing on this issue. In our test-instance the attachments are now going into the g_absolute_path_default_upload_folder directory, not into subdirectories by Project.
cas, I believe you are saying that in order to map uploads to tickets, we would run a (read-only) query against the database in order to gather that information. Is that correct?
We did figure that with a bit of investigation we could do it that way. I am hoping for something more straightforward. Apparently, though, the location and naming of the attachment files does not separate by Project or ticket number.
cas, I believe you are saying that in order to map uploads to tickets, we would run a (read-only) query against the database in order to gather that information. Is that correct?
We did figure that with a bit of investigation we could do it that way. I am hoping for something more straightforward. Apparently, though, the location and naming of the attachment files does not separate by Project or ticket number.
Re: attachment upload to DISK into directories by ticket number
Sad news concerning Cas, see viewtopic.php?t=33894michaelgeorge wrote: 13 Oct 2026, 14:16 cas, I believe you are saying that in order to map uploads to tickets, we would run a (read-only) query against the database in order to gather that information. Is that correct?
Re: attachment upload to DISK into directories by ticket number
Separation by ticket number is not possible out of the box, but you can easily separate storage of attachments per project, by setting the Upload File Path as appropriate in the manage project page.the location and naming of the attachment files does not separate by Project or ticket number
You cannot determine the ticket number from the file name (it's just a hash, i.e. a random sequence of letters and numbers. This is by design.
The only way to get the association, as mentioned by cas, is to look it up in the database (bug_file table), e.g. (adjust table prefix/suffix as needed)
Code: Select all
SELECT p.name, bug_id, f.id "attachment id", filename, diskfile, folder
FROM mantis_bug_file_table f
JOIN mantis_bug_table b ON f.bug_id = b.id
JOIN mantis_project_table p ON b.project_id = p.id
It should not be too hard to write a small script that you could run as needed, that would copy the attachments to an audit-friendly directory structure based on issue id.