Hello,
It seems not possible to archive and download files in a single zip file when working on shinyapp.io server.
The implemented procedure works perfectly running locally but I got this problem looking into the logile provided by the admin interface:
...
*2020-01-28T15:14:19.144899+00:00 shinyapps[1715264]: if (inherits(e, "shiny.silent.error")) *
2020-01-28T15:14:19.151502+00:00 shinyapps[1715264]: 86: stop
*2020-01-28T15:14:19.144895+00:00 shinyapps[1715264]: Called from: (function (e) *
2020-01-28T15:14:19.151505+00:00 shinyapps[1715264]: 84: observeEventHandler [/srv/connect/apps/cytoChain24/server.R#1975]
*2020-01-28T15:14:19.144900+00:00 shinyapps[1715264]: if (is.function(handle)) *
2020-01-28T15:14:19.151504+00:00 shinyapps[1715264]: 85: zip
2020-01-28T15:14:19.144897+00:00 shinyapps[1715264]: {
2020-01-28T15:14:19.151506+00:00 shinyapps[1715264]: 13: runApp
2020-01-28T15:14:19.144899+00:00 shinyapps[1715264]: return()
2020-01-28T15:14:19.151506+00:00 shinyapps[1715264]: 12: fn
2020-01-28T15:14:19.144899+00:00 shinyapps[1715264]: handle <- getOption("shiny.error")
2020-01-28T15:14:19.151507+00:00 shinyapps[1715264]: 7: connect$retry
2020-01-28T15:14:19.144900+00:00 shinyapps[1715264]: handle()
2020-01-28T15:14:19.151507+00:00 shinyapps[1715264]: 6: eval
*2020-01-28T15:14:19.144901+00:00 shinyapps[1715264]: })(list(message = "'files' must a character vector specifying one or more filepaths", *
2020-01-28T15:14:19.151507+00:00 shinyapps[1715264]: 5: eval
2020-01-28T15:14:19.144901+00:00 shinyapps[1715264]: call = zip(zipfile = "./tmpdata/plotMeta.zip", files = Zip_Files)))
2020-01-28T15:14:19.164203+00:00 shinyapps[1715264]: Session stopped
2020-01-28T15:14:19.145505+00:00 shinyapps[1715264]: Warning: Error in zip: 'files' must a character vector specifying one or more filepaths
...
It looks like no files was generated in the server's temporary directory.
On the Server side the code is:
path_to_file <- "./tmpdata"
Zip_Files <- list.files(path = path_to_file, pattern = ".png$", full.names = TRUE)
zip(zipfile = "./tmpdata/plotMeta.zip", files = Zip_Files)
output$downloadMeta <- downloadHandler(
filename = function() {
paste("output", "zip", sep=".")
},
content <- function(file) {
file.copy("./tmpdata/plotMeta.zip", file)
},
contentType = "application/zip")
Could you provide any hint?