|
本帖最后由 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> |
|