我在成功上传文件时遇到错误。 html输入文件就像
<input type="file" name="userfile[]" >
<input type="file" name="userfile[]" >
我的控制器功能包含
$files = $_FILES;
$cpt = count($_FILES['userfile']['name']);
for($i=0; $i<$cpt; $i++)
{
$_FILES['userfile']['name']= $files['userfile']['name'][$i];
$_FILES['userfile']['type']= $files['userfile']['type'][$i];
$_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
$_FILES['userfile']['error']= $files['userfile']['error'][$i];
$_FILES['userfile']['size']= $files['userfile']['size'][$i];
$this->upload->initialize($this->set_upload_options());
$this->upload->do_upload();
}
if(!$this->upload->do_upload('userfile[0]')&&!$this->upload->do_upload('userfile[1]'))
{
$data['message'] = $this->upload->display_errors();
$this->parser->parse('view_fileUploading',$data);
}
else
{
$data['message'] = "Success";
$this->parser->parse('view_fileUploading',$data);
}
和
private function set_upload_options()
{
$id = uniqid();
$new_image_name = 'image_' . $id . '.png';
//upload an image options
$config = array();
$config['upload_path'] = 'images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '0';
$config['overwrite'] = FALSE;
$config['file_name'] = $new_image_name;
return $config;
}
在我的图片文件夹中,我成功上传了所有上传图片,但我也收到了错误,例如“您没有选择要上传的文件”
我想我的
如果($这 - &GT;!upload-&GT; do_upload( 'userfile的[0]')及;&安培;!$这 - &GT; upload-&GT; do_upload( 'userfile的1'))
无法正常使用
我怎样才能正确获得成功的消息?