这是一个文件上传程序,但是就是实现不了上传功能,我也找不出错误来,请各位高手给指点一下啊,万分感激!配置文件都是经过严格测试的,都是100%正确,错误就在我的这个程序里。<?
/***********************************************************************************************
文件名:add_file.php  作者:赵尊杰  最后修改人:赵尊杰  创建日期:2006-11-3
文件简介:对文件上传操作的封装  最后修改日期:2006-11-12
***********************************************************************************************/////////////////////////////////////s1:引用配置文件//////////////////////////////////////include_once('../include/config/database.config.php');
include_once('../include/classes/Database.cls.php');//include_once('../include/classes/Session.cls.php');
include_once('../include/classes/File.cls.php');
include_once('../include/classes/CheckForm.cls.php');
include_once('../include/classes/String.cls.php');include_once('../include/func/status.func.php');
include_once('../include/func/file.func.php');////////////////////////////////////s2:创建对象//////////////////////////////////////////$db_obj=new clsDatabase(WEBSERVER,WEBUSERNAME,WEBPASSWORD,WEBDBNAME);  //数据库操作对象
$cf_obj=new clsCheckForm();                                            //表单验证对象
$str_obj=new clsString();                                              //字符串处理对象
$file_obj=new clsFile();                                            //文件操作对象/*
////////////////////////////////////s3:身份验证////////////////////////////////////////////if(!check_status('admin _download'))
{
   echo "error:身份验证失败!";
   exit;
}
*/////////////////////////////////////s4:接收参数,并做预处理/////////////////////////////////
//文件名
$download_filename_str=$str_obj->delete_space($_POST['file_name'],'all');
//文件描述
$download_introduction_str=$str_obj->delete_space($_POST['file_introduction'],'all');
//上传文件时间
$download_dtime_str=date('Y-m-d h:i:s');
//文件级别 
$download_rank_int=intval($_POST['file_rank']);//取得文件类型
      $fileType_str=$_FILES['file']['type']; 
//取得文件大小
      $fileSize_int=$_FILES['file']['size']; ///////////////////////////////////s5:对参数进行验证,不符合条件则退出程序并报错////////////////文件的名称、级别不能为空
if($cf_obj->is_empty($download_filename_str) or $cf_obj->is_empty($download_rank_int))
{
   echo "error:名称或级别为空!";
   exit;
}//验证文件名称长度是否符合
   if(!$cf_obj->is_suitable_length($download_filename_str,1,20))
   {
      echo "error:文件名称长度不符合要求!";
      exit;
   }
//验证文件描述长度是否符合
   if(!$cf_obj->is_suitable_length($download_introduction_str,0,500))
   {
      echo "error:文件描述长度不符合要求!";
      exit;
   }//验证级别rank参数类型是否符合
if(!$cf_obj->assign_type($download_rank_int,'integer'))
{
   echo "error:参数类型非法!";
   exit;
}///////////////////////////////////s6:主要程序/////////////////////////////////////////////////取得文件id
$downloadId_arr=$db_obj->max_record('download','download_id');
$downloadId_int=$downloadId_arr['download_id'];//设置文件存放路径,可以自己修改
//$upload_path_str="uploadfiles";
//获取文件路径
$download_url_str=$upload_path_str."/".$file_name;//判断是否选定文件
         if($file=="")
{
        echo "error:您还没有选择要上传的文件";
        exit;
}//判断选定的文件是否存在
        if(!file_exists($file))
{
        echo "error:您上传的文件不存在";
        exit;
 }
//检查选定的文件是否重复上传
        if(file_exists($download_url_str))
{
        echo "error:您上传的文件已经存在";
        exit;
 }
//上传文件
        if(!copy($file,$download_url_str))
{
         echo "error:您上传的文件失败,未知原因,请联系程序员!";
        exit;
 }//将文件信息写入数据表--download
//连接数据库
$conn_res=$db_obj->connect();
$db_obj->select();//写入数据表--download
$sql_str="insert into download('download_id','download_filename','download _introduction','download_size','download _type','download_url','download_rank','download _dtime') values ('$downloadId_int','$download_filename_str','$download_introduction_str','$fileSize_int','$fileType_str','$download_url_str','$download_rank_int','$download _dtime_str')";$db_obj->sql($sql_str); //关闭数据库
 $db_obj->close($conn_res);/////////////////////////////////////////程序结束/////////////////////////////////////////////////////?>