Exemplo n.º 1
0
                if ($file_name !== '.' && $file_name !== '..' && $file_name !== $flength_file) {
                    $total_bytes_read += sprintf("%u", @filesize($temp_upload_dir . '/' . $file_name));
                    $files_uploaded++;
                }
            }
            @closedir($handle);
            if ($files_uploaded > 0) {
                $files_uploaded -= 1;
            }
        } else {
            $upload_active = 0;
        }
    }
}
if ($upload_active && $total_bytes_read < $_GET['total_upload_size']) {
    $lapsed_time = time() - $_GET['start_time'];
    if ($_INI['debug_ajax']) {
        if ($_INI['cgi_upload_hook']) {
            showDebugMessage("Set progress: bytes uploaded=" . $total_bytes_read . " files uploaded=" . $files_uploaded . " current file=" . $current_filename . " bytes read=" . $bytes_read . " lapsed time=" . $lapsed_time);
        } else {
            showDebugMessage("Set progress: bytes uploaded=" . $total_bytes_read . " files uploaded=" . $files_uploaded . " lapsed time=" . $lapsed_time);
        }
    }
    setProgressStatus($total_bytes_read, $files_uploaded, $current_filename, $bytes_read, $lapsed_time);
    getProgressStatus($_INI['get_progress_speed']);
} else {
    stopDataLoop();
    if ($_INI['debug_ajax']) {
        showDebugMessage("<span class='ubrWarning'>WARNING</span>: No active upload detected {$path_to_flength_file}");
    }
}
Exemplo n.º 2
0
ob_start();

if(preg_match("/^[a-zA-Z0-9]{32}$/", $_GET['upload_id']) && isset($_GET['start_time']) && isset($_GET['total_upload_size'])){ $UPLOAD_ID = $_GET['upload_id']; }
elseif(isset($_GET['about']) && $_GET['about'] == 1){ kak("<u><b>UBER UPLOADER GET PROGRESS</b></u><br>UBER UPLOADER VERSION =  <b>" . $UBER_VERSION . "</b><br>UBR_GET_PROGRESS = <b>" . $THIS_VERSION . "<b>", 1, __LINE__); }
else{ kak("<font color='red'>ERROR</font>: Invalid parameters passed<br>", 1, __LINE__); }

$read_status = GetBytesRead($TEMP_DIR, $UPLOAD_ID);

if($read_status->active && $read_status->bytes_uploaded < $_GET['total_upload_size']){
	$lapsed_time = time() - $_GET['start_time'];

	if($DEBUG_AJAX){ showDebugMessage("Set progress: bytes uploaded=" . $read_status->bytes_uploaded . " lapsed time=" . $lapsed_time . " uploaded files=" . $read_status->uploaded_files); }

	setProgressStatus($read_status->bytes_uploaded, $lapsed_time, $read_status->uploaded_files);
	getProgressStatus($GET_PROGRESS_SPEED);
}
else{
	stopDataLoop();
	hideProgressBar();

	if($DEBUG_AJAX){
		if(!$read_status->active && $read_status->is_dir_error && !$embedded_upload_results){
			showDebugMessage("<font color='green'>WARNING</font>: Cannot find upload temp directory<br>");
		}
		elseif(!$read_status->active && $read_status->open_dir_error && !$embedded_upload_results){
			showDebugMessage("<font color='green'>WARNING</font>: Cannot open upload temp directory<br>");
		}
	}
}