mac系统下外部访问有关读写配置(本实例为图片上传) chmod

1,图片上传

2,文件权限


function do_add_gift(){

       header("Content-Type: text/html; charset=UTF-8");

       $data = $this->input->post();
        // $id = $data['id'];
        $date = date('Ymd');
$datd = date('YmdHis');
$config['upload_path']      = FCPATH.$this->config->item('upload_path').'mall/'."$date/";
if(!file_exists(FCPATH.$this->config->item('upload_path').'mall/'."$date/")){  
                mkdir(FCPATH.$this->config->item('upload_path').'mall/'."$date/",0777,true);
                chmod(FCPATH.$this->config->item('upload_path').'mall/'."$date/",0755);
          }  
$config['file_name']     = $datd.".jpg";
        $config['allowed_types']    = 'gif|jpg|png';
        $config['max_size']     = 300;
        $config['max_width']        = 400;
        $config['max_height']       = 400;
        $this->load->library('upload', $config);
        if ( !$this->upload->do_upload('userfile')){
         
$ret['msg'] = $this->upload->display_errors();
jsonpcallback($ret);
        }else{
        // $id = $data['id'];
       $setarr = array();


$setarr['title'] = trim($data['title']);
$setarr['voucher'] = trim($data['voucher']);
$setarr['total'] = trim($data['total']);
$setarr['remain'] = trim($data['total']);
$setarr['description'] = trim($data['description']);
$setarr['status'] = 1;
$setarr['create_time'] = time();
$setarr['operator'] = $this->admin['username'];
$setarr['pic'] = 'mall/'."$date/"."$datd.jpg";


if($this->mall_gift_model->insert($setarr)){
$ret['succ'] = 1;
}else{
$ret['msg'] = '失败';
}

jsonpcallback($ret);
        }

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值