php codeigniter上传文件错误
php codeigniter upload file error
这是我的控制器函数,下面是我的视图文件代码请帮助找出我的代码中的错误
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Upload extends CI_Controller {
function __construct(){
parent::__construct();
}
function test(){
if($this->input->post('submit')){
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'].'/assets/uploads/';
$config['allowed_types'] = 'mp4';
$this->load->library('upload',$config);
if ( ! $this->upload->do_upload()){
$error = array('error' => $this->upload->display_errors());
}else{
$data = array('upload_data' => $this->upload->data());
}
}
$this->load->view('upload/test');
}
}
?>
这是我的视图代码->
<form action="" method="POST" enctype="multipart/form-data" >
Select File To Upload:<br />
<input type="file" name="userfile" />
<br /><br />
<input type="submit" name="submit" value="Upload" class="btn btn-success" />
</form>
我收到的错误是 ->
我终于成功了,花了一整天的时间。我在 CI 版本->3.0 上开发这个,当我 将我的系统文件夹 替换为新的 CI VERSION->3.0rc2 它一次运行就像一个魅力,并没有改变上面的一行 code.Both 是 CI- 的开发版本3.But 在更新版本中我的表单验证停止工作,但在上一个版本中它工作正常所以我复制了我的旧版本 system/library/form_validation.php 到同一个地方的新版本,现在工作正常。
这是我的控制器函数,下面是我的视图文件代码请帮助找出我的代码中的错误
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Upload extends CI_Controller {
function __construct(){
parent::__construct();
}
function test(){
if($this->input->post('submit')){
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'].'/assets/uploads/';
$config['allowed_types'] = 'mp4';
$this->load->library('upload',$config);
if ( ! $this->upload->do_upload()){
$error = array('error' => $this->upload->display_errors());
}else{
$data = array('upload_data' => $this->upload->data());
}
}
$this->load->view('upload/test');
}
}
?>
这是我的视图代码->
<form action="" method="POST" enctype="multipart/form-data" >
Select File To Upload:<br />
<input type="file" name="userfile" />
<br /><br />
<input type="submit" name="submit" value="Upload" class="btn btn-success" />
</form>
我收到的错误是 ->
我终于成功了,花了一整天的时间。我在 CI 版本->3.0 上开发这个,当我 将我的系统文件夹 替换为新的 CI VERSION->3.0rc2 它一次运行就像一个魅力,并没有改变上面的一行 code.Both 是 CI- 的开发版本3.But 在更新版本中我的表单验证停止工作,但在上一个版本中它工作正常所以我复制了我的旧版本 system/library/form_validation.php 到同一个地方的新版本,现在工作正常。