Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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 $\上传文件时,文件始终为空_Php_Codeigniter - Fatal编程技术网

Php $\上传文件时,文件始终为空

Php $\上传文件时,文件始终为空,php,codeigniter,Php,Codeigniter,我正在尝试在codeigniter中上载多个图像。但是当我打印($\u文件)时,它总是返回空数组。alse return未定义索引:userfile php.ini file_uploads = On post_max_size = 128M upload_max_filesize = 128M 查看代码: <?php echo form_open_multipart('admin/test', array('id' => 'add-listing'));?> <h

我正在尝试在codeigniter中上载多个图像。但是当我打印($\u文件)时,它总是返回空数组。alse return
未定义索引:userfile

php.ini

file_uploads = On
post_max_size = 128M
upload_max_filesize = 128M
查看代码:

<?php echo form_open_multipart('admin/test', array('id' => 'add-listing'));?>
  <h3>Photo</h3>
  <section>
    <div class="form-group">
      <label>Select photos</label>
      <input type="file" id="files" class="form-control required" name="userfile[]" multiple/>
      <input type="submit" value="Upload File" />
    </div>
    <div class="row" id="photos"></div> //this one for image viewer
  </section>
</form>

我已经尝试了你的代码,它的工作对我来说..所以请显示完整的源代码。你知道我错过了什么吗@NikhilVaghla@IbnuHabibie添加你的PHP代码这就是我的全部代码。在admin/test controller中,我只需打印($文件['userfile']);它返回错误未定义索引:userfile@IbnuHabibie只需使用
print\r($\u文件)和检查我已经尝试了你的代码,它的工作是为我。所以请显示完整的源代码。你知道我错过了什么吗@NikhilVaghla@IbnuHabibie添加你的PHP代码这就是我的全部代码。在admin/test controller中,我只需打印($文件['userfile']);它返回错误未定义索引:userfile@IbnuHabibie只需使用
print\r($\u文件)并检查
function test(){
    print_r($_FILES['userfile']);
}