0
$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?

4

2 回答 2

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'];
于 2013-02-18T08:21:20.320 回答
0

在配置文件中设置文件名。

$config['file_name'] = 'image_' . time();
于 2013-02-18T08:17:32.690 回答