<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class IUploadControll extends CI_Controller{
 
 function __construct(){
  parent::__construct();
  $this->uploaddir = '/upload/images/day_'.date('ymd').'/';
  $config['upload_path']       = './upload/images/day_'.date('ymd').'/';
     $config['allowed_types']     = 'gif|jpg|png';
     $config['max_size']          = '1024';
     $config['max_width']          = '350';
     $config['max_height']         = '400';
     $config['file_name']         = date('YmdHis');
  $this->load->library('upload', $config);
  @mkdir($config['upload_path'], 0777);
 }
 
 /*
  * 上传头像
  */
 public function uploadface(){
  if($this->upload->do_upload('jUploaderFile')){
    $data  = $this->upload->data();
    echo "{ success:true, fileUrl:'".$this->uploaddir.$data['file_name']."' ,fileName:'".$data['file_name']."'}";
    exit;
  }
  echo "{ success:false}";
 }
 
} 
?>

 

上传的文件夹路径为 网站根目录/upload/images/day_120715/文件名

 

相关文章:

  • 2021-11-17
  • 2021-08-29
  • 2021-08-15
  • 2021-07-08
  • 2021-06-12
  • 2021-12-26
猜你喜欢
  • 2021-08-21
  • 2021-11-16
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案