codeigniter文件上传 [英] codeigniter file upload

查看:220
本文介绍了codeigniter文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用codeigniter来上传文件(图像)。我想要做的是修改错误消息,以便它明显哪个字段错误相关,因为在页面上有多个上传选项,下面是我的上传代码,

I am doing the following to upload a file(image) using codeigniter. What I am wanting to do is modify the error message so that it obvious which field the error relates too as there are multiple upload options on the page, below is my upload code,

$config['upload_path'] = './media/uploads/users';
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '1000';
            $config['max_width']  = '90';
            $config['max_height']  = '60';

            $this->upload->initialize($config);

            if(!$this->upload->do_upload('logo_small'))
            {
                $error = array('error' => $this->upload->display_errors());
                $this->template->build('users/employer', $error);
            }
            else
            {
                $file = $this->upload->data();
                $logo_small = "small_".$file['file_name'];
            }

所以基本上我想有错误消息,然后如果错误与徽标大等相关,我想要它说明。

So basically I want there error message to state Logo Small in the error message, and then if the error relates to Logo large etc I would want it to state that.

推荐答案

最简单的方法是编辑系统/ language / english / upload_lang.php与您想要的错误消息。
>

easiest way is to edit system/language/english/upload_lang.php with the error message you want.

这篇关于codeigniter文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆