上传文件时$ _FILES始终为空

时间:2016-08-06 10:24:47

标签: php codeigniter

我正在尝试在codeigniter中上传多个图片。但是当我print_r($_FILES)时,它总是返回空数组。返回undefined index : 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>

[EDITED]

PHP代码:

function test(){
    print_r($_FILES['userfile']);
}

0 个答案:

没有答案