thinkphp图片上传的问题

浏览:1201 发布日期:2013/08/21 分类:求助交流 关键字: 图片上传
<?php

class IndexAction extends Action {
    public function index() {
        $this->display ();
    }
    
    function upload() {
        import ( '@.Rover.UploadFile' );
        $upload = new UploadFile ();
        $upload->imageClassPath = '@.Rover.Image';
        $upload->maxSize = 2097152; // 设置附件上传大小不超过2MB
        $upload->allowExts = array ('jpg', 'gif', 'png', 'jpeg' ); // 设置附件上传类型
        $upload->savePath = './Upload/'; // 设置附件上传目录
        
        if (! $upload->upload ()) { // 上传错误提示错误信息
            $this->error ( $upload->getErrorMsg () );
        } else { // 上传成功 获取上传文件信息
            $info = $upload->getUploadFileInfo ();
            $this->ajaxReturn($info);
        }
    }
      public function UploadImages() {
        import ( '@.Rover.UploadFile' );
        $upload = new UploadFile ();
        //设置需要生成缩略图的文件后缀
        $upload->thumbPrefix = 's_';
        //设置需要生成缩略图,仅对图像文件有效
        $upload->thumb = true;
        //设置缩略图最大宽度
        $upload->thumbMaxWidth = '50,50';
        //设置缩略图最大高度
        $upload->thumbMaxHeight = '50,50';
        $upload->imageClassPath = '@.Rover.Image';
        $upload->maxSize = 2097152; // 设置附件上传大小不超过2MB
        $upload->allowExts = array ('jpg', 'gif', 'png', 'jpeg' ); // 设置附件上传类型
        $upload->savePath = './Upload/'; // 设置附件上传目录

        if (! $upload->upload ()) { // 上传错误提示错误信息
            $this->error ( $upload->getErrorMsg () );
        } else { // 上传成功 获取上传文件信息
            $savaPath = '/Upload/';
            $info = $upload->getUploadFileInfo ();
            $info[0]['delete_type'] = "DELETE";
            $info[0]['delete_url'] = "/Uploadfile=" . $info[0]['savename'];
            $info[0]['name'] = $info[0]['savename'];
            $info[0]['url'] = C("IMG_DOMAIN") . $savaPath .$info[0]['savename'];
            $info[0]['thumbnail_url'] = C("IMG_DOMAIN") . $savaPath . 's_'.$info[0]['savename'];
            
            $this->ajaxReturn($info);
        }
    }
}
在IE下哪里错了呢
最佳答案
评论( 相关
后面还有条评论,点击查看>>