Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
0012942mantisbtattachmentspublic2012-08-17 14:11
Reporterwiertel Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version1.2.4 
Summary0012942: Can't update project documentation file
Description

Attempt to upload updated file to project docs fails with error #503:
Invalid upload path. Directory either does not exist or not writable to webserver.

$g_file_upload_method = DISK;
Upload File Path for this project is valid, writable directory.

In mantis_project_file_table this file has diskfile field set to '7fa581d90e8778f619d741f5eb19023c' and proj_doc_update is using dirname of this value as file upload path.

I've changed proj_doc_update.php to concatenate folder and diskfile to produce absolute path of file on disk but maybe diskfile should always contains full filepath but it's not stored properly.
Attaching diff

Steps To Reproduce

Set upload method to DISK (and directory for project files)
Upload a file as project documentation
Use "Edit" of this project documentation file
Select any file to upload
MantisBT reports error with upload path.

TagsNo tags attached.
Attached Files
proj_doc_update.diff (1,069 bytes)   
--- org/proj_doc_update.php	2011-04-16 09:57:08.000000000 +0200
+++ new/proj_doc_update.php	2011-04-16 09:56:10.000000000 +0200
@@ -67,6 +67,8 @@
 
 		# grab the original file path and name
 		$t_disk_file_name = file_get_field( $f_file_id, 'diskfile', 'project' );
+		if ( strpos( $t_disk_file_name, '/' ) === false )
+			$t_disk_file_name = file_get_field( $f_file_id, 'folder', 'project' ) . $t_disk_file_name;
 		$t_file_path = dirname( $t_disk_file_name );
 
 		# prepare variables for insertion
@@ -74,9 +76,9 @@
 		$c_file_type = db_prepare_string( $v_type );
 		$t_file_size = filesize( $v_tmp_name );
 		$t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
-        if ( $t_file_size > $t_max_file_size ) {
-            trigger_error( ERROR_FILE_TOO_BIG, ERROR );
-        }
+		if ( $t_file_size > $t_max_file_size ) {
+			trigger_error( ERROR_FILE_TOO_BIG, ERROR );
+		}
 		$c_file_size = db_prepare_int( $t_file_size );
 
 		$t_method = config_get( 'file_upload_method' );
proj_doc_update.diff (1,069 bytes)   

Relationships

related to 0001063 closedgrangeway About file uploads 

Activities

AbsolutelyFreeWeb

AbsolutelyFreeWeb

2011-12-31 03:37

reporter   ~0030743

Last edited: 2011-12-31 04:53

what you see is because project docs path is not being set to the value of g_absolute_path_default_upload_folder properly. It will try to upload it to mantis root directory. if you make root writable you will see that the file ends up there.

Same behavior in 1.2.8. Related to 0001063

dregad

dregad

2012-08-08 10:00

developer   ~0032503

As mentioned by AbsolutelyFreeWeb, the upload file path should be set correctly in config_inc.php.