Using DISK to save files

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Using DISK to save files

Post by KenHorse »

*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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Using DISK to save files

Post by atrol »

KenHorse wrote: 22 Feb 2018, 17:10Mantis 2.40
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 ?
Please use Search before posting and read the Manual
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

I don't have an admin directory anymore so I can't check. But I will try the update to 2.11.1
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

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
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

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.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Using DISK to save files

Post by atrol »

After the upgrade, do you get any errors or warnings when running admin/check/index.php ?
Please use Search before posting and read the Manual
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

No errors but quite a few warnings (mostly security related)
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

At his point, I suspect the problem is permissions related.

I can find nothing in the docs about permissions. What should they be?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Using DISK to save files

Post by atrol »

Do you get any errirs or warnings in web server and or PHP error logs?
Please use Search before posting and read the Manual
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

Nope, nothing in the PHP error logs about this

Doesn't APPLICATION ERROR #0 being reported from Mantis mean something?
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Using DISK to save files

Post by atrol »

KenHorse wrote: 07 Mar 2018, 23:23Is there any way to have the files stored with their original filename and extension
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.
Please use Search before posting and read the Manual
Starbuck
Posts: 219
Joined: 14 Feb 2006, 02:53
Location: USA
Contact:

Re: Using DISK to save files

Post by Starbuck »

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.
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!
KenHorse
Posts: 27
Joined: 22 Dec 2011, 00:07

Re: Using DISK to save files

Post by KenHorse »

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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Using DISK to save files

Post by atrol »

KenHorse wrote: 08 Mar 2018, 19:01 similar to how Mantis already does if the same filename is uploaded to the database.
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.
Please use Search before posting and read the Manual
Post Reply