Codeigniter 当代码移动到另一台笔记本电脑时,上传多个图像显示错误
我尽力在我的第一台笔记本电脑上调试这段代码,并成功地解决了它,但现在当我把它移到另一台笔记本电脑上时,它突然又开始显示一些错误,我无法理解其原因 控制器Codeigniter 当代码移动到另一台笔记本电脑时,上传多个图像显示错误,codeigniter,image-upload,Codeigniter,Image Upload,我尽力在我的第一台笔记本电脑上调试这段代码,并成功地解决了它,但现在当我把它移到另一台笔记本电脑上时,它突然又开始显示一些错误,我无法理解其原因 控制器 public function uploadCollateralImage_Front() { $config['upload_path'] = './uploads/files'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['max_size'] =
public function uploadCollateralImage_Front()
{
$config['upload_path'] = './uploads/files';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '2408';
$config['max_width'] = '2408';
$config['max_height'] = '2408';
$this->load->library('upload', $config);
if ( !$this->upload->do_upload('userfile1')){
$error = array('error'.'hey' => $this->upload->display_errors());
var_dump( $error); die;
}else{
$fileName = $this->upload->data();
$post_image = $fileName['file_name'];
// var_dump($post_image); die;
return $post_image;
}
}
看法
它显示了一些错误,比如
数组(1){[“errorhey”]=>字符串(43)”
您没有选择要上载的文件。
" }
这完全意味着它最终并没有保存在数据库中。我认为我的DB是一个错误,可能是因为排序规则或其他原因,但不是因为它只显示了uploadCollateralImage()函数的错误,正如您的评论所示:
将CI安装从PHP版本5.6.23-windows8移动到PHP版本 5.5.11-Windows7终极版 Codeigniter 3.x手册说明: 服务器要求 建议使用PHP 5.6版或更新版本
请检查所有服务器要求您能否尽可能多地提供有关这两种环境的信息。每个操作系统、apache等上的PHP版本。请确保新计算机上有/uploads/files目录,如果还没有,则可能会导致问题。整个系统已克隆到另一个系统,因此我确定它有。@HanthonyTagam您所说的整个系统是什么意思?您需要提供有关PHP、apache、操作系统等的所有信息。从PHP版本5.6.23-windows8到PHP版本5.5.11-Windows7 Ultimate
<?php
$attributes = array('name' => 'applicationform');
$hidden = array('userfile1' => 'userfile1');
echo form_open_multipart("Client_Dashboard/applicationPost",$attributes, $hidden);
?>
<input type="file" name="userfile1" class="w3-margin-left w3-col s10 w3-teal w3-medium w3-hover-white w3-wide " required/>
public function applicationPost(){
$data_vehicleinformation = array();
$data_vehicleinformation['FrontImage'] = $this->uploadCollateralImage_Front();
check_insert_user = $this->foo_app->apply_loan($data_log, $data_user,
$data_loanapplication, $data_collateraldetails_app, $data_vehicleinformation ,
$data_paymentdetails, $data_loanpayment, $data_loanapproval,
$data_loanrequest);
}