【发布时间】:2012-06-18 14:22:48
【问题描述】:
我是 Codeigniter 的新手。处理表单中包含图像的表单验证。在 CodeIgniter 中使用 Module MVC 扩展。
//上传图片我发现这个文件上传sn-p
$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
谢谢
【问题讨论】:
标签: php codeigniter