function type(){
$arr=array(".zip",".rar");
$string=implode($arr);
$str=substr($this->name,-4,4);
if (in_array($str,$arr)){
return $a;
} }
function size(){
if($this->size>1024*1000){
return $this->chenggong;
}
   }
我这样写,我怎么判断上传成功了呢?或者那个能给我一个好的上传的类呢

解决方案 »

  1.   

    上传后的上传文件信息被保存在 $_FILES 数组中,其中有一个 error 键,当该键值为0时,就表示上传成功了,你可以继续操作
      

  2.   

    function type(){
    $arr=array(".zip",".rar");
    $string=implode($arr);
    $str=substr($this->name,-4,4);
    if (in_array($str,$arr)){
    return true;
    }else{
    return false
    }
    这样写是不是说只有这个类为真的时候才有效呀
      

  3.   

    在后台接收input->file里面的值,处理完了存在数据库里面,在返回影响的行数,如果影响行数==1,就给一个提示“上传成功!”,否则提示“上传失败”。