I ask why the file can not be sent to Alibaba Cloud, this code where the wrong

Source: Internet
Author: User
Tags aliyun
    function Uploadopenossserver ($filer, $ossid =1, $type =0) {Global $empire, $dbtbpre, $public _r, $ftp _r, $oss _r, $incftp;                   $PR =getossserverinfo ($OSSID); @include (Ecms_path. "            E/extend/aliyun/oss/sdk.class.php ");                    if (! $PR [hostname]) {if ($pr [osstype]== ' 1 ') {$PR [hostname]= ' oss-cn-hangzhou.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 2 ') {$PR [hostname]= ' oss-cn-hangzhou-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 3 ') {$PR [hostname]= ' oss-cn-qingdao.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 4 ') {$PR [hostname]= ' oss-cn-qingdao-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 5 ') {$PR [hostname]= ' oss-cn-beijing.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 6 ') {$PR [hostname]= ' oss-cn-beijing-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 7 ') {$PR [hostname]= ' oss-cn-hongkong.aliyuncs.com ';} ElseIf ($PR [osstype]==' 8 ') {$PR [hostname]= ' oss-cn-hongkong-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 9 ') {$PR [hostname]= ' oss-cn-shenzhen.aliyuncs.com ';}             else{$pr [hostname]= ' oss-cn-hangzhou-internal.aliyuncs.com ';}            } else{Printerror2 ("OSS node selection error, unable to sync");            } $oss =new Alioss ($PR [access_key_id], $PR [Access_key_secret], $PR [hostname]);        $oss->set_debug_mode (FALSE);            foreach ($filer as $file) {$object =str_replace (Ecms_path, ", $file);            $truefile =rtruepathopen ($PR [bucket], $filenopath);            $oss->upload_file_by_file ($PR [bucket], $object, $file);        Upload file Print_r ($oss);        }//exit OSS $oss =null;                return true; }

Reply content:

    function Uploadopenossserver ($filer, $ossid =1, $type =0) {Global $empire, $dbtbpre, $public _r, $ftp _r, $oss _r, $incftp;                   $PR =getossserverinfo ($OSSID); @include (Ecms_path. "            E/extend/aliyun/oss/sdk.class.php ");                    if (! $PR [hostname]) {if ($pr [osstype]== ' 1 ') {$PR [hostname]= ' oss-cn-hangzhou.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 2 ') {$PR [hostname]= ' oss-cn-hangzhou-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 3 ') {$PR [hostname]= ' oss-cn-qingdao.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 4 ') {$PR [hostname]= ' oss-cn-qingdao-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 5 ') {$PR [hostname]= ' oss-cn-beijing.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 6 ') {$PR [hostname]= ' oss-cn-beijing-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 7 ') {$PR [hostname]= ' oss-cn-hongkong.aliyuncs.com ';} ElseIf ($PR [osstype]==' 8 ') {$PR [hostname]= ' oss-cn-hongkong-internal.aliyuncs.com ';}                    ElseIf ($PR [osstype]== ' 9 ') {$PR [hostname]= ' oss-cn-shenzhen.aliyuncs.com ';}             else{$pr [hostname]= ' oss-cn-hangzhou-internal.aliyuncs.com ';}            } else{Printerror2 ("OSS node selection error, unable to sync");            } $oss =new Alioss ($PR [access_key_id], $PR [Access_key_secret], $PR [hostname]);        $oss->set_debug_mode (FALSE);            foreach ($filer as $file) {$object =str_replace (Ecms_path, ", $file);            $truefile =rtruepathopen ($PR [bucket], $filenopath);            $oss->upload_file_by_file ($PR [bucket], $object, $file);        Upload file Print_r ($oss);        }//exit OSS $oss =null;                return true; }
  • Related Article

    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.