Exemplo n.º 1
0
$adminOb = new adminclass();
if (isset($_SESSION['user'])) {
    //do nothing
} else {
    $adminOb->redirect("index.php");
}
if (isset($_POST['submit'])) {
    $totalFile = count($_FILES);
    $categoryId = $_POST['category'];
    $catePath = $adminOb->getsulgByCid($categoryId);
    for ($i = 0; $i < $totalFile; $i++) {
        $getFilename = "myinput" . $i;
        $scrapimg = $_FILES[$getFilename]['tmp_name'];
        $scrapName = stripslashes($_FILES[$getFilename]['name']);
        $getExtension = $adminOb->getExtension($scrapName);
        $NewName = $adminOb->nameGen();
        $finalScrapName = $catePath . "-" . $NewName . "." . $getExtension;
        $path = "../scrap/" . $catePath;
        move_uploaded_file($scrapimg, $path . '/' . $finalScrapName);
        //for Scrap type
        if ($getExtension == "jpg" || $getExtension == "png") {
            $scrapType = "I";
        } elseif ($getExtension == 'gif') {
            $scrapType = "G";
        } else {
            $scrapType = "F";
        }
        //for generate thumbnails
        if ($getExtension != "swf") {
            $thumb->load($path . "/" . $finalScrapName);
            $thumb->resize(250, 250);