Product SiteDocumentation Site

5.19. File Upload

MantisBT allows users to upload file attachments and associate them with bugs as well as projects. Bug attachments / project documents can be uploaded to the webserver or database. When bugs are uploaded to the webserver they are uploaded to the path that is configured in the project properties. In case of problems getting the file upload feature to work, check the following resources: PHP Manual .
$g_allow_file_upload
Whether to allow/disallow uploading of attachments. Default value is ON.
$g_file_upload_method
Specify the location for uploading attachments. In case of DISK methods you need to provide the webserver with write access rights to the configured upload path (configured in the project) and temporary upload path (used by PHP).
Values: DISK or DATABASE
Default: DATABASE
$g_dropzone_enabled
Whether to enable/disable drag and drop zone for uploading of attachments. Default value is ON.
$g_file_upload_max_num
Maximum number of files that can be uploaded simultaneously. Default value is 10.
$g_max_file_size
Maximum file size that can be uploaded. Default value is about 5MB. The maximum size is also affected by the PHP options post_max_size (default 8MB), upload_max_filesize (default 2MB) and memory_limit (default 128MB) specified in php.ini.
$g_allowed_files
Files that are allowed. Separate items by commas. eg. "zip,bmp,gif,jpg,txt" If $g_allowed_files is filled in NO other file types will be allowed. If empty it will assume any files are accepted that pass the $g_disallowed_files list.
$g_disallowed_files
Files that are not allowed. Separate items by commas. eg. "php,php3,phtml,html,class,java,exe,pl" $g_disallowed_files takes precedence over $g_allowed_files. It is recommended to disable all extensions that can be executed by your server.
$g_preview_attachments_inline_max_size
This limit applies to previewing of image / text attachments. If the attachment size is smaller than the specified value, the attachment is previewed with the issue details. The previewing can be disabled by setting this configuration to 0. The default value is 256 * 1024 (256KB).
$g_fileinfo_magic_db_file
Specify the filename of the magic database file. This is used by PHP 5.3.0 (or earlier versions with the fileinfo PECL extension) to guess what the MIME type of a file is. Usually it is safe to leave this setting as the default (blank) as PHP is usually able to find this file by itself.
$g_file_download_xsendfile_enabled
Enable support for sending files to users via a more efficient X-Sendfile method. HTTP server software supporting this technique includes Lighttpd, Cherokee, Apache with mod_xsendfile and nginx. You may need to set the proceeding file_download_xsendfile_header_name option to suit the server you are using.
$g_file_download_xsendfile_header_name
The name of the X-Sendfile header to use. Each server tends to implement this functionality in a slightly different way and thus the naming conventions for the header differ between each server. Lighttpd from v1.5, Apache with mod_xsendfile and Cherokee web servers use X-Sendfile. nginx uses X-Accel-Redirect and Lighttpd v1.4 uses X-LIGHTTPD-send-file.