Exemplo n.º 1
0
                $fullpath = $dir . "/" . $file;
                //当前文件$dir为文件目录+文件
                if (!is_dir($fullpath)) {
                    //如果传入的参数不是目录,则为文件,应将其删除
                    unlink($fullpath);
                    //删除文件
                } else {
                    deldir($fullpath);
                    //递归删除文件
                }
            }
        }
        closedir($dh);
        //删除当前文件夹:
        if (rmdir($dir)) {
            return true;
        } else {
            return false;
        }
    }
    function judgeFileType()
    {
        if ($_FILES["file2"]["type"] == "image/gif" || $_FILES["file2"]["type"] == "image/jpeg" || $_FILES["file2"]["type"] == "image/png" || $_FILES["file2"]["type"] == "image/pjpeg") {
            return true;
        } else {
            return false;
        }
    }
}
$obj = new UpLoad($_GET["file2"]);
$obj->uploadFile();
Exemplo n.º 2
0
                $fullpath = $dir . "/" . $file;
                //当前文件$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();
Exemplo n.º 3
0
<?php

header('Content-type: text/html; charset=utf-8');
session_start();
require_once '../common/UpLoad.php';
//设置时间格式
date_default_timezone_set('Asia/Shanghai');
//获得要执行的操作
$type = @$_POST['type'];
$type_get = @$_GET['type'];
//执行上传图片
if ("uploadimg" == $type) {
    //上传图片
    $upload = new UpLoad();
    if (isset($_FILES["imgFile"])) {
        $user_name = $_POST["user_head_img_name"];
        $delete_old_img = @$_POST['delete_old_img'];
        //删除图片
        if (isset($delete_old_img)) {
            if ("" != $delete_old_img && "请输入:(图片名)" != $delete_old_img) {
                $upload->deleteUploadImg($delete_old_img);
            }
        }
        //调用上传图片的方法
        $user_head_img_name = $upload->upLoadImg($_FILES["imgFile"], $_POST["user_head_img_name"]);
        require_once '../../../util/StackConst.php';
        StackConst::jump_page("../view/caseuserregister.php?user_name={$user_name}&user_head_img_name={$user_head_img_name}");
    }
} else {
    if ("isExistUser" == $type) {
        //判断用户是否存在