Modify the default attachment storage directory of imperial cms

In the Empire cms system , the uploaded attachments are stored in the /d/file/ folder by default in the root directory. Friends who use Empire CMS to build websites sometimes want to store files in the root directory for the convenience of file management, such as the root directory. files folder.

 

But in the background system parameter setting > attachment address, after changing to /files/, the uploaded file is always not displayed, because we need to modify a file.

Steps

1. Find the ReturnFileSavePath function in the connect.php file in the /e/class/ directory, about line 3647.

2. Change all "d/file/" in the function to "files/".

Modify as follows:

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;

}

3. In the background system parameter setting, modify the attachment address in the basic properties to /files/.

In the background system parameter setting, select the method you need to set in the file setting, no matter which way, it will be stored in the /files/ folder in the root directory instead of the /d/file/ folder .

This modification method is mainly to deal with the storage location of the uploaded pictures in the article, and the location of files such as js and css will not change.

Guess you like

Origin blog.csdn.net/winkexin/article/details/131150315