1
我是Codeigniter的新手。在表单中处理具有图像的表单验证。在CodeIgniter中使用Module MVC扩展。图像类型codeigniter中的验证
//为upooading图像,我发现这个文件上传片断
$config['upload_path'] = './uploads/audio_files/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '2048';
$this->load->library('upload', $config);
if (! $this->upload->do_upload($file_name))
{
$error = array('error' => $this->upload->display_errors());
$file1 = '';
}
else
{
$upload_data = $this->upload->data();
$file1 = $upload_data['file_name'];
}
这是工作的罚款。不是jpeg |的文件gif没有上传。但用户不会收到任何错误消息。我希望用户在上传其他图片类型时显示该特定错误。请帮忙
我试过但失败了。
try 1 : $this->template->load_partial('admin/admin_master', 'admin/form', $error);
try 2. : loading view with $error
感谢
但这将是一个不同的视图页面。我希望这是我的其他表单验证的一部分。 – phpgeek
不一定在同一页上,但那是另一回事。你在找什么叫做“表单验证回调”:[link] http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks [/ link] –