ThinkPHP文件上传错误

浏览:5305 发布日期:2014/04/10 分类:求助交流 关键字: ThinkPHP upload
用ThinkPHP简单的写了一个测试程序,关于上传文件的。可是为什么只能上传一次而已?如果连续上传的话浏览器会报错:Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

MessageAction.class.php代码如下:<?php
    class MessageAction extends Action{
        public function doMess(){
            $message=D('Message');
            $message->create();
            import('ORG.Net.UploadFile');
            $upload = new UploadFile();// 实例化上传类
            $upload->savePath =  './Public/Uploads/';// 设置附件上传目录
            if(!$upload->upload()) {// 上传错误提示错误信息
                $this->error($upload->getErrorMsg());
            }else{// 上传成功 获取上传文件信息
                $info =  $upload->getUploadFileInfo();
            }
            $message->filename = $info[0]['savename']; // 保存上传的照片根据需要自行组装
            $arr=$message->add(); // 写入用户数据到数据库
            if($arr){
                $this->success('数据上传成功!');
            }else{
                $this->error('数据上传失败!');
            }
        }
    }
?>
前台页面代码:<html>
<head>
    <title>Index</title>
</head>
<body>
    <center>
    <form action='__APP__/Message/doMess' method='POST' enctype='multipart/form-data'><!--  -->
        留言题目:<input type='text' name='title'><br>
        留言内容:<textarea name='content'></textarea><br>
        附  件:<input type='file' name='filename'><br>
        <input type='submit' name='submit' value='提交'>
        <input type='reset' name='reset' value='重置'>
    </form>    
    </center>
</body>
</html>
麻烦大神们帮解答一下~~
最佳答案
评论( 相关
后面还有条评论,点击查看>>