CodeIgniter文件中的西里尔文名称

时间:2013-02-18 08:07:15

标签: php codeigniter file-upload

$config['upload_path'] = './uploads/logo/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '0';
$config['max_width']  = '0';
$config['max_height']  = '0';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload('image_bg'))
{
    //$error = array('error' => $this->upload->display_errors());

    //$this->load->view('upload_form', $error);
    echo 'fail';
}
else
{
    //some actions
}

当我上传一个带有西里尔字母名称的文件时,它们看起来更糟糕,在将它上传到codeigniter中的服务器之后,如何将文件名转换为windows-1251 unicode?

2 个答案:

答案 0 :(得分:0)

在config中设置文件名。

$config['file_name'] = 'image_' . time();

答案 1 :(得分:0)

    $config[0]['upload_path'] = './uploaded_files/banner';
    $config[0]['allowed_types'] = 'gif|jpg|png';
    $config[0]['file_name'] = $image_id."_ipad";
    $config[0]['remove_spaces'] = TRUE;
    $config[0]['overwrite'] = TRUE;

    //Loading Library - File Uploading
    $this->load->library('upload');
    $this->upload->initialize($config[0]);

    $this->upload->do_upload('banner_image_ipad');
    $data = array('upload_data' => $this->upload->data());
   $banner_image_ipad = $data['upload_data']['file_name'];