una*_*der 0 r shiny shiny-server shiny-reactivity
我有一个闪亮的网络应用程序。我想创建一个 downloadButton,单击该按钮即可下载 PowerPoint 文件。我需要在 downloadHandler 函数中添加什么才能从某个文件路径读取 PowerPoint 文件,然后将该文件下载给按下按钮的用户?
您可以使用该file.copy功能。以下是c:/temp.
library(shiny)
ui <- fluidPage(
downloadButton("downloadFile", "Download File")
)
server <- function(input, output) {
fileName <- "test.pptx"
filePath <- "c:/temp"
output$downloadFile <- downloadHandler(
filename = function() {
fileName # default file name use by browser, it could be different
},
content = function(file) {
file.copy(file.path(filePath, fileName), file)
}
)
}
shinyApp(ui = ui , server = server)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1449 次 |
| 最近记录: |