Esempio n. 1
0
                //当前文件$dir为文件目录+文件
                if (!is_dir($fullpath)) {
                    //如果传入的参数不是目录,则为文件,应将其删除
                    unlink($fullpath);
                    //删除文件
                } else {
                    deldir($fullpath);
                    //递归删除文件
                }
            }
        }
        closedir($dh);
        //删除当前文件夹:
        if (rmdir($dir)) {
            return true;
        } else {
            return false;
        }
    }
    function judgeTxtType()
    {
        if ($_FILES["file0"]["type"] == "image/gif" || $_FILES["file0"]["type"] == "image/jpeg" || $_FILES["file0"]["type"] == "image/png" || $_FILES["file0"]["type"] == "image/pjpeg" || $_FILES["file0"]["type"] == "application/pdf" || $_FILES["file0"]["type"] == "application/msword" || $_FILES["file0"]["type"] == "application/x-rar-compressed" || $_FILES["file0"]["type"] == "application/zip" || $_FILES["file0"]["type"] == "application/x-zip-compressed" || $_FILES["file0"]["type"] == "application/octet-stream" || $_FILES["file0"]["type"] == "text/plain" || $_FILES["file0"]["type"] == "application/vnd.ms-excel" || $_FILES["file0"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || $_FILES["file0"]["type"] == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") {
            return true;
        } else {
            return false;
        }
    }
}
$obj = new UpLoad($_GET["file0"]);
$obj->uploadTxt();