function PhpUploader_GetSystemTempFolder()
{
    $str = ini_get('upload_tmp_dir');
    if ($str == null || strlen($str) == 0) {
        $str = "/tmp";
        if (!is_dir($str)) {
            $str = dirname(__FILE__);
        }
    } else {
        if (!is_dir($str)) {
            $result = PhpUploader_MakeDir(__FILE__, __LINE__, $str, 0777);
            if (!$result) {
                throw new Exception("The folder {$str} does not exist.  Please check the permission or specify a temp folder using TempDirectory property.");
            }
        }
    }
    if (substr($str, strlen($str) - 1) != "/") {
        $str = $str . "/";
    }
    $str = $str . "uploadertemp";
    if (!is_dir($str)) {
        $result = PhpUploader_MakeDir(__FILE__, __LINE__, $str, 0777);
        if (!$result) {
            throw new Exception("Unable to create temp folder: {$str}  Please check the permission or specify a temp folder using TempDirectory property.");
        }
    }
    return $str;
}
function PhpUploader_GetSystemTempFolder()
{
    $str = PhpUploader_GetSysBaseTempFolder();
    if (substr($str, strlen($str) - 1) != "/") {
        $str = $str . "/";
    }
    $str = $str . "uploadertemp";
    if (!is_dir($str)) {
        $result = PhpUploader_MakeDir(__FILE__, __LINE__, $str, 0777);
        if (!$result) {
            throw new Exception("Unable to create temp folder: {$str}  Please check the permission or specify a temp folder using TempDirectory property.");
        }
    }
    return $str;
}