<?php
    $id = $_POST['sessionId'];
    $id = trim($id);
    session_name($id);
    session_start();

    if($_SESSION['dhxvlt_state']==-1)
    {
	// -1 is set in UploadHandler.php after a successful upload
	// send 100% back and mark state for invalidation
    	echo 100;
	$_SESSION['dhxvlt_state'] = -2;

    } else if($_SESSION['dhxvlt_state']==-2)
    {
	// -2 is set above to invalidate current upload session
    	echo -1;
        session_destroy();

    } else if($_SESSION['dhxvlt_state']==-3)
    {
	// -3 is set in UploadHandler.php in case of some error (like filename encoding, "post_max_size" oversized).
	$maxPost = ini_get('post_max_size');
    	echo "error:-3:$maxPost:";
        session_destroy();
    }
	else
		echo $_SESSION['dhxvlt_state'];
?>