View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0012942 | mantisbt | attachments | public | 2011-04-16 04:14 | 2012-08-17 14:11 | 
| Reporter | wiertel | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always | 
| Status | closed | Resolution | no change required | ||
| Product Version | 1.2.4 | ||||
| Summary | 0012942: Can't update project documentation file | ||||
| Description | Attempt to upload updated file to project docs fails with error #503: $g_file_upload_method   = DISK; 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.  | ||||
| Steps To Reproduce | Set upload method to DISK (and directory for project files)  | ||||
| Tags | No 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' );
 | ||||
| 
	 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  | 
|
| 
	 As mentioned by AbsolutelyFreeWeb, the upload file path should be set correctly in config_inc.php.  | 
|