Codeigniter文件未在实时上传

时间:2014-07-07 22:11:05

标签: php image codeigniter file-upload

我正在使用CI,我有一个问题,我的文件没有在实时服务器上传,相同的代码在上传功能上返回TRUE

我的控制器

 $tempfilename   =   $_FILES['photo_file']['name'];
 $temparr    = explode('.',$tempfilename);

            $datas = array(
                'banner_ads_title' => $banner_ads_title,
                'banner_ads_redirect_url' => $banner_ads_redirect_url,
                'banner_ads_status' => $banner_ads_status,
                'banner_ads_banner_type' => $banner_ads_banner_type,
                'fk_affiliate_network_id' => $fk_affiliate_network_id,
                'banner_ads_use_sid' => $banner_ads_use_sid,
                'banner_ads_create_date' => date("Y-m-d H:i:s")
            );
            $insertId = $this->bannerModel->add($datas);

            //$this->db->insert('tbl_banner_ads', $datas);
            $photo_name = $banner_ads_title . '_' . $insertId.'.'.$temparr[1];
            $config['file_name'] = $photo_name;
           // echo $config['file_name'];
            $this->load->library('Upload', $config);
            echo "<pre>";
            print_r($config);
           var_dump($this->upload->do_upload('photo_file'));
            $uploaddata = $this->upload->data();
            $datas = array(
                'banner_ads_image' => $uploaddata['file_name']
            );
            echo "<pre>";
            print_r($uploaddata);
            print_r($datas);exit;

以上代码返回以下内容 在使用xampp的Windows上

Array
(
    [upload_path] => ./public/admin/uploads/banner
    [allowed_types] => gif|jpg|png|jpeg
    [max_size] => 20000000
    [file_name] => test14_35.jpg
)
bool(true)

Array
(
    [file_name] => test14_35.jpg
    [file_type] => image/jpeg
    [file_path] => G:/xampp/htdocs/myproject/public/admin/uploads/banner/
    [full_path] => G:/xampp/htdocs/myproject/public/admin/uploads/banner//test14_35.jpg
    [raw_name] => test14_35
    [orig_name] => test14_35.jpg
    [client_name] => target.jpg
    [file_ext] => .jpg
    [file_size] => 56.62
    [is_image] => 1
    [image_width] => 700
    [image_height] => 352
    [image_type] => jpeg
    [image_size_str] => width="700" height="352"
)
Array
(
    [banner_ads_image] => test14_35.jpg
)

在CentOS(实时服务器)

Array
(
    [upload_path] => ./public/admin/uploads/banner
    [allowed_types] => gif|jpg|png|jpeg
    [max_size] => 20000000
    [file_name] => test134_34.jpg
)
bool(false)
Array
(
    [file_name] => test134_34.jpg
    [file_type] => 
    [file_path] => /var/www/html/myproject/public/admin/uploads/banner
    [full_path] => /var/www/html/myproject/public/admin/uploads/banner/test134_34.jpg
    [raw_name] => test134_34.jpg
    [orig_name] => 
    [client_name] => 
    [file_ext] => 
    [file_size] => 
    [is_image] => 
    [image_width] => 
    [image_height] => 
    [image_type] => 
    [image_size_str] => 
)
Array
(
    [banner_ads_image] => test134_34.jpg
)

0 个答案:

没有答案