用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3369|回复: 1
收起左侧

[HELP] 请问下CI下使用uploadify的问题

[复制链接]
发表于 2013-4-24 14:49:12 | 显示全部楼层 |阅读模式
本帖最后由 ahkxhyl 于 2013-4-24 15:12 编辑

<input type="file" id="userfile" name="userfile" class="tfiles"/>
$('#userfile').uploadify({
                                         'swf': "/js/uploadify/new/uploadify.swf",//上传的Flash,不用管,路径对就行
                                        'uploader':"<?=base_url()?>photo/upphoto",//Post文件到指定的处理文件
                                        fileSizeLimit   : "10MB",        //上传文件大小限制
                                        buttonText: '上传照片',  //浏览按钮的Text
                                        width:100,//浏览按钮宽
                                        sizeLimit: '20048000',//20M
                                        uploadLimit     : 20,
                                         cancelImage: "/js/uploadify/new/uploadify-cancel.png",//取消按钮的图片地址
                                        checkExisting:"/photo/checkupphoto",//验证是否上传成功
                                        'fileExt'     : '*.jpg;*.gif;*.png',
                                        'auto'      : true,
                                        'multi'     : true,
                                         'onComplete'  : function(event, ID, fileObj, response, data) {
                                                 
                                                alert(response);
                                        }
                                });

控制器
function xx(){
部分代码省略
$path = $_SERVER["DOCUMENT_ROOT"] . "/upfiles/photo/" . $uid;
            if (!file_exists($path)) {
                mkdir($path, 0777);
            }

            $config['upload_path'] = "./upfiles/photo/" . $uid . "/";
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '1000000';
            $config['max_width'] = '6000';
            $config['max_height'] = '6000';
            $config['encrypt_name'] = 'true';

            $this->load->library('upload', $config);


            if (!$this->upload->do_upload()) {
                echo -1;
            } else {
                $this->load->library('image_lib');

                $redata = $this->upload->data();

}
在没使用uploadify前控制器代码那没有任何问题,现在改为使用uploadify,程序只能执行到if (!$this->upload->do_upload()) {                echo -1;


输出-1 就停了,请问下如果使用CI自带的upload类 那么我这段代码应该怎么改
刚刚我把echo -1;换成 echo $this->upload->display_errors();
提示是<p>You did not select a file to upload.</p>
发表于 2014-8-22 00:10:29 | 显示全部楼层
文件格式不对,你的的FLASH上传组件,是以二进置的,你有二种解决方法,一种是在JPG或GIF里增加二进置类型或在PHP.INI 开启extension=php_fileinfo.dll

本版积分规则