What is the best practice for storing a file uploaded via POST in PHP to be used across multiple scripts without permanently saving it?

When dealing with file uploads in PHP, the best practice for storing a file uploaded via POST to be used across multiple scripts without permanently saving it is to store it in a temporary location on the server. This can be achieved by using the PHP `$_FILES` superglobal to move the uploaded file to a temporary directory and then passing the file path to other scripts as needed.

// Check if file was uploaded
if(isset($_FILES['file'])){
    $tempFilePath = $_FILES['file']['tmp_name'];
    
    // Move the uploaded file to a temporary directory
    $tempDestination = 'temp/' . $_FILES['file']['name'];
    move_uploaded_file($tempFilePath, $tempDestination);

    // Pass the file path to other scripts as needed
    $_SESSION['tempFilePath'] = $tempDestination;
}