【发布时间】:2019-12-26 17:37:08
【问题描述】:
我有一个上传文件的代码。使用操作按钮“保存到数据库”上传文件后,我将文件名和文件路径存储在向量中。
在同一个应用程序中,我有另一个选项卡以表格形式显示 excel 输出。因此,为了读取文件,我使用在使用操作按钮保存文件时检索到的文件路径。
问题是我得到“文件不存在”,因为路径如下所示
“C:\Users\Arun\AppData\Local\Temp\RtmpINivvL/69ff834f0b2623ef2ec95c41/0.xlsx”
虽然我上传文件的位置是
" "D:/Data_Dump/summary.xlsx"
如何解决这个问题?
UI.R code
tabItem(tabName = "file",
mainPanel(
titlePanel(h2("Upload your XLSX file here ")), fluidRow(
column(6,
fileInput('file1', 'Choose a XLSX file to upload',
accept = c('.xlsx'))),
column(6,actionButton("save","Save to Database")),
div(DT::dataTableOutput("contents"),style = "font-size: 100%;width: 150%")
)
)
)
server.R code
eventReactive(input$save,{
filenm <- input$file1
filenm$name
tablelist <<- c(tablelist,as.character(filenm$name))
print(tablelist)
filePath <<- c(filePath,as.character(filenm$datapath))
print(filePath)
return (tablelist)
})
【问题讨论】:
标签: r user-interface shiny shinydashboard