예제 #1
0
<?php

header("Content-Type:text/html;charset=UTF-8");
include "../../function/function.php";
include "../../gd.php";
//宣告tool物件
$tool = new tools_h();
if (isset($_POST['submit'])) {
    $array = array(0 => "", 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5", 6 => "6", 7 => "7", 8 => "8", 9 => "9", 10 => "10");
    //暫存檔名 0為無效
    for ($i = 1; $i <= 10; $i++) {
        if ($_FILES["pic" . $i]["size"] > 1024 * 300) {
            $tool->showmessage("檔案大小超過限制!");
            $tool->submitURL("upload.php");
            //判斷從何處進入檔案
            exit;
        } else {
            $path = "../images";
            // 檢查是否已有此使用者目錄
            if (!is_dir($path)) {
                mkdir($path, 0755);
            }
            //以上為新增目錄
            if ($_FILES["pic" . $i]["size"] > 0) {
                $t1 = $_FILES["pic" . $i]['name'];
                $ext = strrchr($t1, '.');
                //***************************圖檔格式限制Begin********************************************
                if ($_FILES["pic" . $i]['type'] != 'image/pjpeg' and $_FILES["pic" . $i]['type'] != 'image/jpeg') {
                    $checkment++;
                }
                if ($checkment == 1) {