View Issue Details

IDProjectCategoryView StatusLast Update
0037021mantisbtattachmentspublic2026-04-14 07:02
Reportervicsuarez Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version2.28.0 
Summary0037021: proj_doc_update.php: ERROR_FILE_INVALID_UPLOAD_PATH error when updating document content
Description

proj_doc_update.php build incorrect server path when documents are stored in DISK.

$t_disk_file_name = file_get_field( $f_file_id, 'diskfile', 'project' );
$t_file_path = dirname( $t_disk_file_name );

Always gets "." as file path because 'diskfile' field only contains the file name with no path information. In file_api.php the path is obtained from configuration:

    if( $t_project_id == ALL_PROJECTS ) {
        $t_file_path = config_get_global( 'absolute_path_default_upload_folder' );
    } else {
        $t_file_path = project_get_field( $t_project_id, 'file_path' );
        if( is_blank( $t_file_path ) ) {
            $t_file_path = config_get_global( 'absolute_path_default_upload_folder' );
        }
    }
Steps To Reproduce

1 - Edit a project document
2 - Select new file to upload
3 - Submit form

TagsNo tags attached.

Activities

vicsuarez

vicsuarez

2026-04-14 07:02

reporter   ~0071009

Error is generated when proj_doc_update.php calls fiel_ensure_valid_upload_path (file_api.php) with "." as path:

function file_ensure_valid_upload_path( $p_upload_path ) {
    if( !file_exists( $p_upload_path ) || !is_dir( $p_upload_path ) || !is_writable( $p_upload_path ) || !is_readable( $p_upload_path ) ) {
        throw new ServiceException(
            'Upload folder not valid',
            ERROR_FILE_INVALID_UPLOAD_PATH );
    }
}

If MantisBT directory is not writable for web server userid then the part '''!is_writable($t_upload_path)''' is "true" and ERROR_FILE_INVALID_UPLOAD_PATH is generated.