Php CodeIgniter上载文件无文件

Php CodeIgniter上载文件无文件,php,codeigniter,Php,Codeigniter,好的,尝试上传文件几个小时,但我发现错误 You did not select a file to upload. 我的代码在CI中 $this->config = array( 'upload_path' => dirname($_SERVER["SCRIPT_FILENAME"])."/uploads/", 'upload_url' => base_url()."uploads/

好的,尝试上传文件几个小时,但我发现错误

You did not select a file to upload.
我的代码在CI中

 $this->config =  array(
                  'upload_path'     => dirname($_SERVER["SCRIPT_FILENAME"])."/uploads/",
                  'upload_url'      => base_url()."uploads/",
                  'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|xml",
                  'overwrite'       => TRUE,
                  'max_size'        => "1000KB",
                  'max_height'      => "768",
                  'max_width'       => "1024"  
                );

             $this->load->library('upload', $this->config);
            if($this->upload->do_upload('logo'))
            {
                echo "file upload success";
            }
            else
            {
               echo $this->upload->display_errors();
            }
在我看来

<input type="file" name="logo"/>

哪里可能是错误,它非常重要

尝试更改
$this->load->library('upload',$this->config)

 $this->load->library('upload');
 $this->upload->initialize( $this->config );
表单类型也应该是multipart

<form method="post" action="some_action" enctype="multipart/form-data" />

在配置中尝试以下操作:

'upload_path'     => FCPATH . "/uploads/", // or use "./uploads/" instead
'max_size'        => "1000", // remove the kb from the string. it requires only the number

. 只需快速浏览一下,我就可以在您的配置阵列中发现至少两个错误。您是否尝试过
$this->upload->display_errors()
查看它报告了什么?根据文档,没有名为
upload_url
的选项。根据文档中的代码示例,他可以使用
$this->load->library('upload',$this->config)
:为什么投反对票?很可能是多部件类型给他带来了一些麻烦。是的,我想很多人都知道手册的存在。这是一个建议,因为他的建议不起作用。你永远也不会知道,大多数在网上询问的人经常会粘贴不一定是他们实际拥有的代码。请再次阅读我的评论。使用
$this->load->library('upload',$this->config)
没有任何问题,我链接到文档以支持此断言,而不是告诉您在哪里可以找到文档。删除你答案的前半部分,看看下一个投票者是否重新计算。我在文档中也没有看到名为
upload\u url
的选项。真的!这就是我删除它的原因。如果您同时“删除”了有效选项,如“覆盖”
、“最大宽度”等,那么阅读本文的人怎么会知道“上传url”不是有效选项?您是什么意思???上传url没有这样的选项。如果你想要的话,你可以把它们放在其他地方。我的意思是,OP使用了一个名为
upload\u url
的不存在的选项,而你没有指出这是一行无效的代码。
'upload_path'     => FCPATH . "/uploads/", // or use "./uploads/" instead
'max_size'        => "1000", // remove the kb from the string. it requires only the number