HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/www.winghung.com/demo_v4/upload.php
<?php
    //計算總共上傳幾個檔案
	error_reporting(E_ALL);
	ini_set('display_errors', 1);
	require_once('../wp-load.php'); 
	session_start();
	date_default_timezone_set("Asia/Hong_Kong"); 
	global $wpdb, $sitepress;

    $i=count($_FILES["uploadFile"]["name"]);

    //利用for迴圈將所有檔案置入資料夾
    for ($j = 0; $j < $i; $j++){
        //利用if判斷式判斷是否上傳成功
        if($_FILES["uploadFile"]["error"][$j] == 0){
            //如果檔案成功置入資料夾(此程式碼設定為根目錄)
			$timestamp = time();
			$hash = md5("WH".$timestamp);			
			$name = $_FILES["uploadFile"]["name"][$j];
			$file = $timestamp."_".$name;
            if(move_uploaded_file($_FILES["uploadFile"]["tmp_name"][$j], "upload/".$file)){
				if($wpdb->insert('custom_upload_files', ['hash'=>$hash, 'name'=>$name, 'file'=>$file, 'timestamp'=>$timestamp])){ // write record to database
					echo "<meta http-equiv='refresh' content='0; url=result.php?hash=".$hash."'>"; // redirect
				} else {
					echo "Sorry! We cannot accept your file(s). <br>Please kindly contact our Customer Services";	
				}
            }else{ 
                echo "Sorry! We cannot accept your file(s). <br>Please kindly contact our Customer Services";
            }
        } else {
            echo "Invalid File";
        }
    }
?>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Wing Hung Printing Solution</title>
<style>
        * { margin: 0; padding: 0; }

        html {
            /*background: url(./1.jpg) no-repeat center center fixed;*/
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
        }   

        #page-wrap { 
            width: 400px;
            margin: 50px auto;
            padding: 20px;
            background: white;
            opacity: 0.8;
            -moz-box-shadow: 0 0 20px black; 
            -webkit-box-shadow: 0 0 20px black; 
            box-shadow: 0 0 20px black;
        }
        p { font: 15px/2 Verdana; margin: 0 0 30px 0; text-indent: 40px; }
    </style>
	
	</head>
	<body>
    </body>
</html>