## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(shiny.semantic)
ui <- semanticPage(
form(
div(
class = "ui grid",
div(
class = "four wide column",
file_input("ex", "Select file"),
header("File type selected:", textOutput("ex_file"))
)
)
)
)
server <- function(input, output, session) {
output$ex_file <- renderText({
if (is.null(input)) return("No file uploaded")
tools::file_ext(input$ex$datapath)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab