Ejemplo n.º 1
0
    $ext = strtolower($path_ext);
    $data = file_get_contents($fileTempName);
    switch ($ext) {
        case 'jpg':
        case 'jpeg':
        case 'png':
        case 'gif':
            // get file content
            $data = file_get_contents($fileTempName);
            // caching using local file name as key
            //$m->set($fileName,$data,0);
            $redis->set($fileName, $data);
            // 範例:把目前時間當成 message 送給 input queue
            // (縮圖程式的 message 內容改為圖片位置以及希望得到的 size 等資訊)
            date_default_timezone_set('Asia/Taipei');
            $send = $sqs->sendMessage($input_queue, $fileName);
            echo "Message Send: <br>";
            print_r($send);
            echo "<br>";
            // saving file on S3
            if ($s3->putObjectFile($fileTempName, "nccus3", $fileName, S3::ACL_PUBLIC_READ)) {
                echo "We successfully uploaded your file.";
            } else {
                echo "Something went wrong while uploading your file... sorry.";
            }
            break;
        default:
            echo "File type not supported!";
    }
}
/* end 上傳表單判斷 */