Php codeigniter->上载空问题

Php codeigniter->上载空问题,php,codeigniter,upload,Php,Codeigniter,Upload,我得到以下错误: 列“thumbpath”不能为空 我试过$thumb\u info=$thumb\u info=$this->image\u lib->resize;然后在$data数组中,我将其设置为'thumbpath'=>$thumb\u info['create\u thumb'],但这会导致PHP错误 致命错误:调用第60行addimage.php中非对象的成员函数resize 我还在努力获取要发布到视图中的错误或成功消息: 看法 模型 第58行: 'thumbpath' =>

我得到以下错误:

列“thumbpath”不能为空

我试过$thumb\u info=$thumb\u info=$this->image\u lib->resize;然后在$data数组中,我将其设置为'thumbpath'=>$thumb\u info['create\u thumb'],但这会导致PHP错误

致命错误:调用第60行addimage.php中非对象的成员函数resize

我还在努力获取要发布到视图中的错误或成功消息:

看法

模型

第58行:

'thumbpath' => $file_info['create_thumb']
我不相信来自$this->upload->data的“create_thumb”是一个有效字段

也许你想要:

 'thumbpath' => $config['new_image'].$this->upload->file_name  
好的-关于第二个问题,正确的拇指路径,我想你需要这样的东西:

$imagefullpath = $config['new_image'].$this->upload->file_name;
$path_parts = pathinfo($imagefullpath);
$imageextension = $path_paths['extension'];
$imagerenamed = $part_parts['dirname'].'/'.$path_parts['filename'].'_thumb'.$imageextension;
未经测试,并确保至少运行PHP5.2


让我知道结果如何。

我通过执行以下操作解决了此问题:

    $data = array(   
    'description' => $this->input->post('description', TRUE), 
    'fullpath' => $file_info['file_name'],
'thumbpath' =>$file_info['raw_name'].'_thumb'.$file_info['file_ext'] 
    ); 

是的,因为这会启动我代码的resize部分,就像if语句中的$config为上传设置$config一样。我需要做的是得到一行,它保存了要插入到dbI中的新图像名称。我已经尝试了上面的方法-这有点效果-它保存了完整路径+原始文件名-它应该保存原始文件名。\u thumbOk-所以你只是说它应该是这样的:'thumbpath'=>$config['new\u image'].$this->upload->file\u name.“u thumb”谢谢,我试过了,但它在.pnghmm之后添加了“u thumb”。。好的,试试这个:$imagefullpath=$config['new\u image'].$this->upload->file\u name$path_parts=pathinfo$imagefullpath$imageextension=$path_paths['extension'];
 'thumbpath' => $config['new_image'].$this->upload->file_name  
$imagefullpath = $config['new_image'].$this->upload->file_name;
$path_parts = pathinfo($imagefullpath);
$imageextension = $path_paths['extension'];
$imagerenamed = $part_parts['dirname'].'/'.$path_parts['filename'].'_thumb'.$imageextension;
    $data = array(   
    'description' => $this->input->post('description', TRUE), 
    'fullpath' => $file_info['file_name'],
'thumbpath' =>$file_info['raw_name'].'_thumb'.$file_info['file_ext'] 
    );