Codeigniter Fil上传CI 3

时间:2016-07-19 09:52:04

标签: php codeigniter upload

  

我正在尝试上传zip文件或jpg文件,但我一直收到错误

     

- 不允许您尝试上传的文件类型。

$this->_check();


$this->load->helper('string');

$email=$this->input->post('email');

$orderid=$this->input->post('order');

   $_FILES['filename']['name'];

// $_FILES['filename']['type']; 
// $_FILES['filename']['tmp_name'];
// $_FILES['filename']['size'];
 $xyz=$ext = pathinfo( $_FILES['filename']['name'], PATHINFO_EXTENSION);


$config['upload_path'] = './assets/upload/zipfiles/' ;

    $config['allowed_types'] = 'zip';
 $ac=$config['file_name']="final_".$orderid."_".$email."_".random_string('alnum',5).".".$xyz;

  print_r($config);echo "<Br><br><br>"; print_r($_FILES);

       $this->upload->initialize($config);

  if($this->upload->do_upload('filename')){

    $zipname='assets/upload/zipfiles/'.$ac['file_name'];

    echo $zipname;

  }else{        

     echo $this->upload->display_errors();
    }
}
  

我的阵列配置和文件名

Array ( [upload_path] => ./assets/upload/zipfiles/ [allowed_types] => gif|jpg|png [file_name] => final_160716163335-p4IM5Tu_emailaddress.com_R6JLk.jpg ) 

Array ( [filename] => Array ( [name] => a b c.jpg [type] => image/jpeg [tmp_name] => C:\wamp\tmp\phpFAF6.tmp [error] => 0 [size] => 105 ) )

0 个答案:

没有答案