Error while using fileinput in shiny

shiny
r
shinydashboard

#1

I am trying to develop an application with Shiny, where the user uploads a test file(csv format), and the data needs to be pre - processed and predictions are made accordingly.

For this reason, I started with uploading a file using fileinput command in shiny.

I incorporated my dashboard design and for some reason, I am not able to view the dataframe and its summary statistics.

Below is my UI and Server code,

Could anyone help me what I am missing here,I am new to shiny.

ui<-dashboardPage(
  dashboardHeader(title = "Claim Model"),
  dashboardSidebar(
    sidebarMenu(id="tabs",
                menuItem("Data", tabName = "data", icon = icon("table"),startExpanded = TRUE,
                         menuSubItem("Load", tabName = "data1")
                         
                ),
                menuItem("Visualisation",icon=icon("bar-chart-o"), tabName = "vis"),
                menuItem("Result", icon=icon("cog"), tabName = "result")
    )
  ),
  dashboardBody(
    tags$style(type="text/css",
               ".shiny-output-error { visibility: hidden; }",
               ".shiny-output-error:before { visibility: hidden; }"
    ),
    tabItems(
      tabItem(tabName = "data1",
              fluidPage(
                fluidRow(
                  fileInput("file","Choose CSV File",
                            accept = c("text/csv",
                                       "text/comma-seperated-values, text/plain",
                                       ".csv")
                  ),
                  tags$hr(),
                  checkboxInput("header", "Header", TRUE),
                  radioButtons("sep","Separator",
                               choices=c(Comma=",",
                                         semicolon=";",
                                         Tab="\t"),
                               selected = ";")
                ),
                mainPanel(
                  uiOutput("tb")
                )
              )
      )
    )
  )
) 

Server Code

server <- shinyServer(function(input,output){
 data <- reactive({
   file1 <- input$file
   if(is.null(file1)){return()}
   read.csv(file = file$datapath, sep=input$sep)
 })
 output$filedf <- renderTable({
   if(is.null(data())){return()}
   input$file
 })
 output$sum <- renderTable({
   if(is.null(data())){return()}
   summary(data())
 })
 output$table <- renderTable({
   if(is.null(data())){return()}
   data()
 })
 output$tb <- renderUI({
   if(is.null(data())){return()}
   tabsetPanel(tabPanel("About file", tableOutput("filedf")),tabPanel("Data", tableOutput("table")),tabPanel("Summary", tableOutput("sum")))
     
 })
  })

Any information would be helpful.