Using DISK to save files
Moderators: Developer, Contributor
Using DISK to save files
*nix based system, PHP 7.xx. Mantis 2.40 Scheme Version 199
Mantis root directory - /var/www/mantis
Mantis works just fine if I allow files to be stored into database. But if I change to DISK and point to absolute path of /var/www/mantis/files, I get the following error
APPLICATION ERROR #0
An error occurred during this action. You may wish to report this error to your local administrator.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
premissions are good
Mantis root directory - /var/www/mantis
Mantis works just fine if I allow files to be stored into database. But if I change to DISK and point to absolute path of /var/www/mantis/files, I get the following error
APPLICATION ERROR #0
An error occurred during this action. You may wish to report this error to your local administrator.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
premissions are good
Re: Using DISK to save files
I assume you mean 2.4.0. I recommend to upgrade to latest version (2.11.1 at the moment)
Do you get any errors or warnings when running admin/check/index.php ?
Re: Using DISK to save files
I don't have an admin directory anymore so I can't check. But I will try the update to 2.11.1
Re: Using DISK to save files
Well..trying to update to 2.11.1 and running into this error: (have been following the docs about upgrading)
CREATE TABLE mantis_api_token_table ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, user_id INTEGER NOT NULL DEFAULT 0, name VARCHAR(128) NOT NULL, hash VARCHAR(128) NOT NULL, date_created INTEGER UNSIGNED NOT NULL DEFAULT 0, date_used INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id) )DEFAULT CHARSET=utf8
Table 'mantis_api_token_table' already exists
Not sure where to go from here
CREATE TABLE mantis_api_token_table ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, user_id INTEGER NOT NULL DEFAULT 0, name VARCHAR(128) NOT NULL, hash VARCHAR(128) NOT NULL, date_created INTEGER UNSIGNED NOT NULL DEFAULT 0, date_used INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id) )DEFAULT CHARSET=utf8
Table 'mantis_api_token_table' already exists
Not sure where to go from here
Re: Using DISK to save files
I do have an update about this but I'm thinking that perhaps I should take this over the HELP section?
Anyway, updated to 2.11.1 and still the same issue with saving uploads to disk
APPLICATION ERROR #0
An error occurred during this action. You may wish to report this error to your local administrator.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
Anyway, updated to 2.11.1 and still the same issue with saving uploads to disk
APPLICATION ERROR #0
An error occurred during this action. You may wish to report this error to your local administrator.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
Re: Using DISK to save files
No errors but quite a few warnings (mostly security related)
Re: Using DISK to save files
At his point, I suspect the problem is permissions related.
I can find nothing in the docs about permissions. What should they be?
I can find nothing in the docs about permissions. What should they be?
Re: Using DISK to save files
Nope, nothing in the PHP error logs about this
Doesn't APPLICATION ERROR #0 being reported from Mantis mean something?
Doesn't APPLICATION ERROR #0 being reported from Mantis mean something?
Re: Using DISK to save files
OK, I finally got this working! (it was a permissions thing).
Now, last question. Is there any way to have the files stored with their original filename and extension instead if the (apparently) encrypted name as Mantis stores them currently? I want to have a directory repository of all uploaded files that certain users can SCP to and grab as needed
Now, last question. Is there any way to have the files stored with their original filename and extension instead if the (apparently) encrypted name as Mantis stores them currently? I want to have a directory repository of all uploaded files that certain users can SCP to and grab as needed
Re: Using DISK to save files
Not possibble, you would have to change source code for that.
But keep in mind, that you will still not always be able to store files with their original name. E.g. you have to change names if someone tries to attach a file that does already exist.
Re: Using DISK to save files
To add to what @atrol said, consider what happens if someone adds an attachment called sample.csv, and then a month later someone creates a completely different ticket, attaching a completely different file that happens to have the same name.
Or what about a scenario where someone adds this week's report.doc, and then shows how it differs from a prior version by attaching last week's report.doc. You certainly don't want one to over-write the other.
Do you force people to use unique filenames? OK, that's a different approach with it's own considerations.
Think through the details of these scenarios. Propose solutions.Then maybe a new discussion can be started about a customization/plugin that uses whatever solutions you propose.
Or what about a scenario where someone adds this week's report.doc, and then shows how it differs from a prior version by attaching last week's report.doc. You certainly don't want one to over-write the other.
Do you force people to use unique filenames? OK, that's a different approach with it's own considerations.
Think through the details of these scenarios. Propose solutions.Then maybe a new discussion can be started about a customization/plugin that uses whatever solutions you propose.
If you want Mantis to work differently, use or create a plugin. Visit the Plugins forums.
Ask developers to create a plugin that you need - and motivate them to help you!
Ask developers to create a plugin that you need - and motivate them to help you!
Re: Using DISK to save files
Simple fix for the duplicate filename issue.
Check to see if filename already exists and, if so, append (for example) a suffix of some sort, similar to how Mantis already does if the same filename is uploaded to the database. For example
sample.csv already exists so rename the new one to sample-1.csv
Check to see if filename already exists and, if so, append (for example) a suffix of some sort, similar to how Mantis already does if the same filename is uploaded to the database. For example
sample.csv already exists so rename the new one to sample-1.csv
Re: Using DISK to save files
Mantis does this independent from storage to database or disk. Files are automatically renamed if you add a file with the same name to the SAME issue. There is no renaming if you add files with the same name to DIFFERENT issues.