diff --git a/resources/php/sse.php b/resources/php/sse.php index 58f8292..67155e3 100644 --- a/resources/php/sse.php +++ b/resources/php/sse.php @@ -2,14 +2,17 @@ // Start the session session_start(); - if (isset($_SESSION["state"])) { - $state = $_SESSION["state"]; + if (isset($_SESSION["refreshState"])) { + $state = $_SESSION["refreshState"]; + } else { + $state = "none"; + $_SESSION["refreshState"] = $state; } header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); echo "data:" . $state . "\n\n"; - $_SESSION["state"] = "none"; + $_SESSION["refreshState"] = "none"; flush(); ?> diff --git a/resources/php/upload.php b/resources/php/upload.php index 93d2f52..fc8a2f5 100755 --- a/resources/php/upload.php +++ b/resources/php/upload.php @@ -52,14 +52,13 @@ function uploadFiles($targetDir) { if ($uploadOk !== 0) { if (move_uploaded_file($fileTmpName, $targetFile)) { echo "Server: [Success] --> The file " . $fileName . " has been uploaded."; + $_SESSION["refreshState"] = "updateListing"; } } else { echo "Server: [Error] --> Your file " . $fileName . " was not uploaded."; } } echo ""; - - $_SESSION["state"] = "updateListing"; } // Check access type.