Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter form_open_multipart()在V2.2.0中显示为空白_Php_Html_File Upload_Formbuilder - Fatal编程技术网

Php Codeigniter form_open_multipart()在V2.2.0中显示为空白

Php Codeigniter form_open_multipart()在V2.2.0中显示为空白,php,html,file-upload,formbuilder,Php,Html,File Upload,Formbuilder,我正在使用codeigniter的最新版本V2.2.0,并希望使用upload类创建一个非常简单的单文件上传。然而,当我尝试使用form\u open\u multipart创建表单并使用$this->input->post as post数组时,总是会得到一个空白页。但是当我使用$时,一切都很好。我一直在四处寻找,但我似乎不知道如何使这项工作。 我还加载表单helper$this->load->helper'form'; HTML uploadPage.php <body> <

我正在使用codeigniter的最新版本V2.2.0,并希望使用upload类创建一个非常简单的单文件上传。然而,当我尝试使用form\u open\u multipart创建表单并使用$this->input->post as post数组时,总是会得到一个空白页。但是当我使用$时,一切都很好。我一直在四处寻找,但我似乎不知道如何使这项工作。 我还加载表单helper$this->load->helper'form'; HTML uploadPage.php

<body>
<?php echo form_open_multipart('upload/theUpload');?>
<input type="file" name="userfile">
<input type="submit" name="submit" value="Upload File">
</form>
</body>

$this->input->post会不经意地返回false,因为您没有提到要使用post检索的值的名称。请在代码中进行以下更改:

ifisset$邮政

如果!空的$邮政

见帖子

您也可以这样做:

如果$this->input->post'userfile'//userfile是post的名称 变数


谢谢你的回复。但是您应该知道,$this->input->post为您提供了完整的post数组,返回一个包含所有post项调用的数组,不带任何参数。。所以$this->input->post中没有任何错误。我总是使用这段代码来获得完整的数组。因此,我认为还有另一个问题。仍在等待正确的解决方案…: