【发布时间】:2016-04-15 13:01:47
【问题描述】:
如何在上传前获取文件值?这是示例代码。
<html>
<head>
<title>Upload Form</title>
</head>
<body>
<?php echo $error;?> <!-- Error Message will show up here -->
<?php echo form_open_multipart('upload_controller/do_upload');?>
<?php echo "<input type='file' name='userfile' size='20' />"; ?>
<?php echo "<input type='submit' name='submit' value='upload' /> ";?>
<?php echo "</form>"?>
</body>
</html>
这是控制器。
...
public function do_upload()
{
///////////////////////////////////////////////
// Hear i want to show filename before upload.
///////////////////////////////////////////////
echo var_dump( $this->input->post('userfile') );
///////////////////////////////////////////////
...
}
我尝试显示“userfile”值,但它总是显示为空。我怎样才能显示这个值。
【问题讨论】:
-
使用
var_dump($_FILES); -
$this->input->post没有得到文件信息
标签: codeigniter file-upload codeigniter-3