Here's an example of what I mean. (Set the prefix variable to a short string prefix that makes sense for your app, so if you see these files in your R tmp dir you can tell what they are.)
library(shiny)
ui <- fluidPage(
"This session's unique file is located at", textOutput("path", container = tags$code)
)
prefix <- "myapp-"
server <- function(input, output, session) {
# Make a unique file for this session
filepath <- tempfile(paste0(prefix, session$token), fileext = ".txt")
output$path <- renderText(filepath)
}
shinyApp(ui, server)