|
发表于 2012-8-2 11:32:09
|
显示全部楼层
俺一次就成功了,,,
顺便把他的上传方法扩展了下,,现在有缩略图了
public function upload() {
$file_forder = 'uploads/'; //文件目录
$file_name = date('YmdHis').rand(1000, 9999); //新文件名
$config['upload_path'] = FCPATH.$file_forder; //文件保存路径 这儿我用的是实际路径
$config['allowed_types'] = 'jpg|jpeg|gif|png|jpe'; //允许上传格式
$config['max_size'] = '1024'; //允许上传大小
$config['file_name'] = $file_name; //存放的文件名
$this->load->library('upload', $config);
$field_name = 'Filedata'; //上传表单字段名
if ($this->upload->do_upload($field_name)) {
$data = $this->upload->data();
$config['image_library'] = 'gd2';
$config['source_image'] = FCPATH.$file_forder.$data['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 120;
$config['height'] = 80;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$img = base_url().$file_forder.$data['file_name']; //返回给SWF AND JQUERY显示的IMAGE地
exit ('FILEID:'.$img);
}
} |
|