Ecstore php 上传文件

$_POST 获取pay_ceritficate //上传的文件名称信息
if($_POST['pay_certificate']){ //保存支付凭证
    $_path = MEDIA_DIR.'/certificate/';
    list($type, $data) = explode(',', $_POST['pay_certificate']);
    do{
        $photoname1 = 'pay_'.md5(microtime()).'.jpg';
        $picpath = $_path.$photoname1;
    }while(file_exists($picpath));
    $reture1 = file_put_contents($picpath, base64_decode($data), true);
    if($reture1){
        //kernel::base_url(1); //获取域名
        $picpath_url = kernel::base_url(1).'/public/images/certificate/'.$photoname1;
    }

    if(!$reture1){
        $this->begin();
        $this->end(false,  app::get('b2c')->_('照片上传失败!'));
    }
}

猜你喜欢

转载自blog.csdn.net/yangpit/article/details/81486055