|
public function uploadexcel()
{
if(!empty($_FILES['upfile']['name'])){
if(!file_exists("upload/Excel/".date("Y/m/d")))
{
mkdir("upload/Excel/".date("Y/m/d"),0777,true);//原图路径
}
$config['upload_path'] ="upload/Excel/".date("Y/m/d");
$file_name=mt_rand(1111,9999).time();
$config['file_name']=$file_name;
$config['allowed_types'] = 'xls|xlsx|zip|csv|txt';
$config['max_size'] = '10000000';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('upfile'))
{
echo '<script type="text/javascript">alert("上传失败");location.href ="javascript:history.go(-1);"</script>';
// $this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
print_r($data);
exit;
}
|
|