帝国cms系统,上传的附件默认是存放于根目录下/d/file/文件夹中,使用帝国CMS建站的朋友,有时为了方便管理文件,想将文件存放在根目录中,比如根目录下的files文件夹中。
但是在后台系统参数设置>附件地址,修改为/files/后,上传的文件总是显示不出来,这是因为我们需要修改一个文件。
操作步骤
一、找到/e/class/目录中的connect.php文件中的ReturnFileSavePath函数,大概在3647行。
二、将函数中的"d/file/"全部修改为"files/"。
修改如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | //返回附件目录 function ReturnFileSavePath( $classid , $fpath = '' ){ global $public_r , $class_r ; $fpath = $fpath || strstr ( ',' . $fpath . ',' , ',0,' )? $fpath : $public_r [ 'fpath' ]; $efileurl =eReturnFileUrl(); if ( $fpath ==1) //p目录 { $r [ 'filepath' ]= 'files/p/' ; $r [ 'fileurl' ]= $efileurl . 'p/' ; } elseif ( $fpath ==2) //file目录 { $r [ 'filepath' ]= 'files/' ; $r [ 'fileurl' ]= $efileurl ; } else { if ( empty ( $classid )) { $r [ 'filepath' ]= 'files/p/' ; $r [ 'fileurl' ]= $efileurl . 'p/' ; } else { $r [ 'filepath' ]= 'files/' . $class_r [ $classid ][classpath]. '/' ; $r [ 'fileurl' ]= $efileurl . $class_r [ $classid ][classpath]. '/' ; } } return $r ; } |
三、在后台系统参数设置中,基本属性中修改附件地址为/files/。
在后台系统参数设置中,文件设置中选择你需要设置的方式,不管哪种方式,最后都会是存放在根目录下的/files/文件夹中,而不再是/d/file/文件夹中。
该修改方法,主要是应对文章中上传图片的存放位置,js和css等文件位置不会变动。