Upload Files to Disk

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
CBuilder
Posts: 5
Joined: 11 Nov 2015, 08:38

Upload Files to Disk

Post by CBuilder »

Hello

I am trying to make Mantis upload files to disk instead of database, so I used this configuration in the config_inc file

$g_file_upload_method = DISK;

but I get this error whenever I try to upload a file

APPLICATION ERROR #503
Invalid upload path. Directory either does not exist or not writable to webserver.

I am not sure if should configure a path for uploads or there is a default path and where to find it.

Please help...
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Upload Files to Disk

Post by atrol »

There is a global setting, but I recommend this way:
Goto page Manage > Manage Projects
Click on a project name
Change field "Upload File Path"
Repeat steps for each of your projects.
Please use Search before posting and read the Manual
CBuilder
Posts: 5
Joined: 11 Nov 2015, 08:38

Re: Upload Files to Disk

Post by CBuilder »

atrol wrote:There is a global setting, but I recommend this way:
Goto page Manage > Manage Projects
Click on a project name
Change field "Upload File Path"
Repeat steps for each of your projects.
I created a folder named "files" inside my mantis folder deployed in apache on windows (XAMPP) and gave "Everyone" full permissions then filled the suggested field with the following value "\files\"

But when i tried to update the project i received the same error

APPLICATION ERROR #503
Invalid upload path. Directory either does not exist or not writable to webserver.
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Upload Files to Disk

Post by atrol »

You have to enter the complete absolute path.
Please use Search before posting and read the Manual
CBuilder
Posts: 5
Joined: 11 Nov 2015, 08:38

Re: Upload Files to Disk

Post by CBuilder »

Thank you, adding absolute path solved the issue e.g. "c:\files"

I strongly recommend adding it to documentation to help others configuring their servers :)

Thanks again
NandoNaldo
Posts: 122
Joined: 09 Mar 2016, 21:44

Re: Upload Files to Disk

Post by NandoNaldo »

atrol wrote:There is a global setting, but I recommend this way:
Goto page Manage > Manage Projects
Click on a project name
Change field "Upload File Path"
Repeat steps for each of your projects.
Hello,

I was searching for the same thing. We are using Mantis 1.2.19 but in the Manage > Manage Projects > project name i could not see the field "Upload File Path"

Any help please ?
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Upload Files to Disk

Post by atrol »

@NandoNaldo, maybe you have not set

Code: Select all

$g_file_upload_method = DISK;
Keep in mind that after setting $g_file_upload_method = DISK; you will not able able to read existing attachments which are stored in database.
Those old attachments have to be migrated to file system.
Please use Search before posting and read the Manual
NandoNaldo
Posts: 122
Joined: 09 Mar 2016, 21:44

Re: Upload Files to Disk

Post by NandoNaldo »

Yes, you are right. The follwing config of my Mantis:

# --- Attachments / File Uploads ---
$g_allow_file_upload = ON;
# $g_file_upload_method = DATABASE; # or DISK
# $g_absolute_path_default_upload_folder = ''; # used with DISK, must contain trailing \ or /.

Question:

- I should migrate manually all the files manually?
- after changing $g_file_upload_method = DISK;, the DISK can be a file server ?
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Upload Files to Disk

Post by atrol »

I can't recommend to change to DISK using version 1.2.19 as there is this bug between versions 1.2.16 and 1.2.19 https://www.mantisbt.org/bugs/view.php?id=20340

So you should at least upgrade to 1.2.20 or even better to latest 1.3 or latest 2.0

After that
NandoNaldo wrote: - I should migrate manually all the files manually?
No, there is a tool coming with Mantis to do the job.
Run ../admin/system_utils.php to get an impression (you might have to restore directory admin as you have been told to remove it after installation)
NandoNaldo wrote: - after changing $g_file_upload_method = DISK;, the DISK can be a file server ?
It must be a directory where your webserver has rights to create files. It can be on your local file system or on a file server.
Please use Search before posting and read the Manual
NandoNaldo
Posts: 122
Joined: 09 Mar 2016, 21:44

Re: Upload Files to Disk

Post by NandoNaldo »

Thank You for your help. As i understand better the version less problems :)

Till now i was trying to avoid an upgrade to 2.4.0 or 2.4.1 because i'm afraid of losssing date and i am not sure if the tables of issue, projects, bug and all of that are compatible beetwen versions.

I don't know if upgrading to a higher version will cause lose of data ?

Thnx
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Upload Files to Disk

Post by atrol »

NandoNaldo wrote:I don't know if upgrading to a higher version will cause lose of data ?
Upgrade should not loose any data, that's why it's highly recommended to create a backup of your database before upgrading.

In case you plan to upgrade to 2.x, first ensure that your server meets the requirements https://www.mantisbt.org/docs/master/en ... e.versions
Please use Search before posting and read the Manual
Post Reply