Phpcms allows you to upload images from different sites to different folders.

Source: Internet
Author: User

1. Modify the configuration file system. php

The code is as follows: Copy code

// Configure the attachment
'Upload _ path' => PHPCMS_PATH. 'Upload /',
'Upload _ path_danji '=> PHPCMS_PATH. 'Danji/upload/', // upload path of images on the standalone site
'Upload _ path_mobile '=> PHPCMS_PATH. 'Upload/shouji/', // upload path of the mobile station image
'Upload _ url' => '/upload/', // attachment path
'Upload _ url_danji '=>'/danji/upload/', // path of the attachment to the standalone site
'Upload _ url_mobile '=>'/upload/shouji/', // path of the mobile phone station attachment

2. Search for "upload_path" in the folder"
Search for "upload_path" in the folder, and you can find that the configuration parameter is used for the extra files. Here, the configuration parameter is to be modified and determined based on the current site.
For example, modules/attachment/attachments. php

The code is as follows: Copy code
Function _ construct (){
Pc_base: load_app_func ('global ');
$ This-> siteid = param: get_cookie ('siteid ');
If ($ this-> siteid = 1 ){
$ This-> upload_url = pc_base: load_config ('system', 'upload _ url ');
$ This-> upload_path = pc_base: load_config ('system', 'upload _ path ');
} Elseif ($ this-> siteid = 2 ){
$ This-> upload_url = pc_base: load_config ('system', 'upload _ url_danji ');
$ This-> upload_path = pc_base: load_config ('system', 'upload _ path_danji ');
} Elseif ($ this-> siteid = 3 ){
$ This-> upload_url = pc_base: load_config ('system', 'upload _ url_mobile ');
$ This-> upload_path = pc_base: load_config ('system', 'upload _ path_mobile ');
 }
 
$ This-> imgext = array ('jpg ', 'GIF', 'PNG', 'bmp ', 'jpeg ');
$ This-> userid = param: get_cookie ('userid ')? Param: get_cookie ('userid'): param: get_cookie ('_ userid ');
$ This-> isadmin = $ this-> admin_username = $ _ SESSION ['roleid']? 1: 0;
$ This-> groupid = param: get_cookie ('_ groupid ')? Param: get_cookie ('_ groupid'): 8;
}

Modify the constructor and read the corresponding upload_path parameters and path parameters based on the current site. If the modification is made in several places, I will not list them one by one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.